Workflow - Define variable errors out while using replacement

I am trying to define a variable to hold a url. The URL needs a value from a previous step.

I am giving a static string as a input (https://api.XXXX.com/USERID/credentials) and i plan to replace USERID with the value retrieved from previous step.
image

  • What errors did you face (share screenshots)?
    While testing the workflow I am getting parsing error. It retrieves the values from the previous step correctly but throws an error while executing the step

image

Note : I am doing this because i cannot use the https://api.xxx.com/**$.httprequest2.body.data[0].id**/credentials in the Request URL of the HTTP action

Hi @nileshnikalje,

Have you tried with https://api.xxx.com/{{$.httprequest2.body.data[0].id}}/credentials to see if it works.?

Thanks @jesvin90 .Looks like it is hitting the api but not treating long integers properly. The response from the previous http requests is

{
  "body": {
    "data": [
      {
        "id": 48195078,
        "suspended": false,
      }
    ],
  },
  "statusCode": 200
}

And the http request step input using the previous response is

{
  "suppliedInlineExpression": {
    "requestHeaders": "{\"Authorization\":\"Bearer {{$.hTTPRequest.body.access_token}}\"}",
    "url": "https://api.xxxx.com/v1/api/users/{{$.hTTPRequest2.body.data[0].id}}/credentials"
  },
  "textRequestBody": null,
  "url": "https://api.xxxx.com/v1/api/users/4.8195078e+07/credentials",
  "urlParams": null
}

The number 48195078 is appended as 4.8195078e+07

Try defining the variable as $.httprequest2.body.data[0].id

And then call the API referring the variable, something like https://api.xxx.com/{{$.variable}}/credentials and see how it behaves.

It renders null value as output

The input to the step

{
  "suppliedInlineExpression": {
    "requestHeaders": "{\"Authorization\":\"Bearer {{$.hTTPRequest.body.access_token}}\"}",
    "url": "https://api.xxxx.com/v1/api/users/{{$.defineVariable.brivoUserID}}/credentials"
  },
  "textRequestBody": null,
  "url": "https://api.xxxx.com/v1/api/users//credentials",
  "urlParams": null
}

Looks like a bug where number data type is not processed correctly. The application documentation is at Loading.... The response returns id as a 8 digit number which is not parsed by the HTTP or Define variable steps of workflow. Where should i raise this bug?

Hi Nilesh,

Try below JSON path in URL

"{{$.hTTPRequest2.body.data[0].id}}"

Same error. The workflow engine is not able to handle numbers. I faced that within a loop too. The loop.loopInput.id gets converted to an exponential format