Adding Json Body to a HTTP request

Hi Need to add the below request to a HTTP Request.

However I cant workout how to escape the double quotes, I’ve tried using “”"
but it doesn’t seem to be accepted by the editor

Code I want

{

“type”: “select”,

“where”: {

"TriggerHoursUpdate": "True"

}

}

Code I tried:-
“{ “”“type””": “”“Select”"", “”“Where”"": { “”“TriggerHoursUpdate”"": “”“True”"" }"}"

Could anyone advise on how to do this?

Hi @barryrodick

Better way is to write the json body to be written in text file and then use read text file activitiy and store the data in string variable and placing the string varaible in json body part of http request activitiy

Hope the idea helps you

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

1 Like

Thanks, much easier!

1 Like

Spoke too soon, seems odd. It loads correctly but its acting like its not being passed correctly into the body of the request.

image

This is the in text file

{ “type”: “select”,“where”: { “TriggerHoursUpdate”: “True” }}

Do u mean it is not getting the correct http request ?

@barryrodick

  1. Open notepad, paste below code in notepad
    {
    “type”: “select”,
    “where”: {
    “TriggerHoursUpdate”: “True”
    }
    }
  2. Read this via UiPath and updatte Json body with output

Note: Always validate your josn
Use Ref : https://jsonlint.com/

Hi, the endpoint works and I get the right result in postman,

But instead of returning 1 result, I get the whole table.

Its like UiPath isn’t passing the query within the Body of the HTTP request

Hay, the json is valid, but UiPath isnt passing it within the body of hte request.

@barryrodick
The column you have in your table is of what datatype ?

it’s from this API

1 Like

@barryrodick Let me give it a shot

@barryrodick
Will it be possible for you to show your table

What exactly are you after?

If I run the query in postman i get 1 result,

if I run in UiPath I get the entire table, its like the body isn’t being passed at all

Its strange as well if I use

image

item.SelectToken(“data”)(“Name”).ToString it will work fine

If I use SelectToken(“data”)(“TriggerHours”).ToString it throws an error object instance not set to an instance of an object

Hi All,

Still struggling with this, any guidance would be gratefully received.

I am reading my JSON file (Json is valid and works in postman)

image

this is then stored in a text variable JsonBody which is passed into HTTP request

However, my output is like the JSON body was never passed HTTP request

@barryrodick
Isn’t it’s a post request and not Get

### Run queries on a data source

#### `POST v1/data-sources/<dataSourceId>/data/query`

e.g. `v1/data-sources/123/data/query`

Request body (JSON):

Ref: Data Sources REST APIs | Fliplet Developers Documentation

@barryrodick

Are you able to resolve your issue ?
I tried something similar and it worked perfectly.

Here is the result : -

image

If i change it to Get, see result below

image

So it appears I’m an idiot.

Thanks all

@barryrodick

Just a miss nothing else.
Happy Automation

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