REST API Call body problem

Hi,

I am trying to make a POST call in UiPath. Following is the body that I am passing:

But it is throwing following error:

"{\"type\":\"https://tools.ietf.org/html/rfc7231#section-6.5.1\",\"title\":\"One or more validation errors occurred.\",\"status\":400,\"traceId\":\"00-2fe623da09af2e429f75d174981c568b-567cb59d5693eb4f-00\",\"errors\":{\"$\":[\"'l' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.\"]}}"

In Postman this error comes when there are no quotes around the request body for instance:

I tried passing the request body as well but no progress.

Can anyone help me with a solution?

@Umer_Shahid

If you are trying from postman…then there is a option on right top of postman which will give you the curl url…you can paste it directly in the UiPath studio activity wizard to get the request populated properly

cheers

Can you please make a small flow to show? @Anil_G

@Umer_Shahid

Please check this

Click this icon on postman
image

Then copy the curl
image

CLick import
image

Paste the curl there

Output

Remove --Location from curl

curl --request POST 'https://devapi.simplefm.io/api/WorkOrders' \
--header 'Accept: application/json, text/plain, */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkMWY0OTk0OS1kOTE1LTQ1MjgtOGYzYy05M2UwNzYzNDg4N2UiLCJVc2VySWQiOiIxNjI2NiIsIlVzZXJUeXBlIjoiMSIsIlVzZXJFbWFpbCI6InphaW51bGFiaWRpbmtoYW5AaG90bWFpbC5jb20iLCJDbGllbnRJZCI6IiIsIlBhcnRuZXJJZCI6IiIsIkF1dGhvcml6ZWRSb2xlcyI6IjYiLCJSb2xlQmFzZWRQZXJtaXNzaW9ucyI6IjYsNywzMCwzNywxMiwzMSIsImV4cCI6MTY3NTI3NDM4NCwiaXNzIjoiaHR0cHM6Ly9zaW1wbGVmbS5pbyIsImF1ZCI6Imh0dHBzOi8vc2ltcGxlZm0uaW8ifQ.zZDhu48f8ylSREA42Q9MXlvGeSZsfQsfg97iSokiwRY' \
--header 'Connection: keep-alive' \
--header 'DNT: 1' \
--header 'Origin: https://dev.simplefm.io' \
--header 'Referer: https://dev.simplefm.io/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.70' \
--header 'content-type: application/json' \
--header 'sec-ch-ua: "Not_A Brand";v="99", "Microsoft Edge";v="109", "Chromium";v="109"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "Windows"' \
--data-raw '{
    "locationId": "99643",
    "poNumber": "null",
    "clientWONumber": "123",
    "tradeId": "24",
    "priorityId": "2",
    "nte": "500",
    "cnte": "500",
    "description": "test",
    "reason": "test",
    "clientId": "1252",
    "createdById": "16266",
    "typeId": "1",
    "Flags": []
}'

cheers

Already did it. 400 error is being thrown.

@Umer_Shahid

On Postman you are able to get the response properly?

cheers

@Anil_G Yep!

Fixed it. Issue was while buidling request body.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.