How to send body using POST method of HTTP Request activity

Hi @ClaytonM Thanks for the support. It worked :slight_smile:

2 Likes

Hi @Bhaskar_Mukka,

I tried with escaping the double quotes too. But after hitting the request, I get the error as “error:request is not valid json”.
Any insights into this?
@ClaytonM @aksh1yadav

Thanks!

Hi @Akanksha_Varshney,

I have gone through you post

Can you please share the original request body. So that I can try from my end and let you know what is the issue.

Hi @Bhaskar_Mukka,
Thanks for checking.
Following is the original Request Body, that is working fine in Postman.
{
“default_phone_number”:null,
“password”: “qwer1234”,
email":"av@avtest.com”,
“first_name”:“AV”,
“is_admin”: true,
“last_name”:“Admin”,
“permissions”:{
“edit_apps”:true,
“edit_commcare_users”:true,
“edit_data”:true,
“edit_web_users”:true,
“view_report_list”:[
],
“view_reports”:true
},
“phone_numbers”:[
],
“role”:“Admin”,
username":"av@avtest.com
}

Request Body as string:
“{‘default_phone_number’:null,’password’: ‘qwer1234’,’email’:’av@avtest.com’,’first_name’:’Joe’,’is_admin’: True,’last_name’:’Admin’,’permissions’:{‘edit_apps’:True,’edit_commcare_users’:True,’edit_data’:True,’edit_web_users’:True,’view_report_list’:,’view_reports’:True},’phone_numbers’:,’role’:’Admin’,’username’:’av@avtest.com’}”

Thanks!

1 Like

Hi @Akanksha_Varshney

Can you please try the attached request body and let me know is it working or not.

RequestBody.json (413 Bytes)

Note: Please open the json file in notepad and try.

Hey @Bhaskar_Mukka,

Was able to resolve the issue bu reading the JSON from a text file, without making it a string value.
Thanks @aksh1yadav for all the help!

1 Like

Hey Neha,

Did you find out the solution for your problem? . It would be a great favour if you can share the solution for the above problem.

Thanks

I don’t know whether this solves the issue or not, but will help you for sure

Hi Neha, Even I am facing the same issue. And also could you please tell me hw you bale to pass the json object in the body.

Hello ,
Here you have a playlist with 10 videos all working with HTTP Request working with Salesforce, ServiceNow, and Jira. So you can see exactly how I work with parameters all videos have Chapters to be able to find very fast what you want.

Thanks,
Cristian Negulescu

1 Like

its throwing error for me

Hi @malhotraneha162000,

Try the below format to pass Dynamic Variables:
“{ ““body””: ““Test””,”“subject”“:”“” +subject+ “”“, ““topicId””:”“” +topicID+ “”“, ““submitter””: “””+ submitter+ “”“}”
For Dynamic Variables, we have to provide double Quotes 3 times in body format. Then it can provide the final output with one double quote. Then bot will consider it as a proper JSON Format.

Hello Team,
I’m facing issues while passing the below json to body parameter, any pointer would be really grateful.
{
“name”:“Test”
“parent_id”: dynamic value.ToString
“type”:“112”
“roles”:{
“Testing”:{
“field_1”:“1234”
“field_2”:“test”
“field_3”:"test
}
}
}

Thanks,
Gokul

Heyy @gokul3

Just pass the same json in a single line instead of passing in multiple lines.

Let me know if that works

@HareeshMR Thank you so much for the response.

I tried giving it in the single line as suggested, I’m getting a new issue “end of the expression expected”
Body format is form-data:
{“name”:“Test”,“parent_id”: “12312”,“type”:“112”,“roles”:{“Testing”:{“field_1”:“1234”,“field_2”:“test”,“field_3”:“test”}}}

Hi Everyone,

i was facing this issue while facing the Payload in “application/text” format by giving the body as below.

{“code_type”: “add”,“process_id”: 81,“code_status”: “inprogress”,“run_startdate”: “2022-08-17T10:21:01.006214700Z”,“log_level”: “”,“message”: “”,“devicerunner_name”: “scalp”,“input_transactions_count”: 2,“environment”: “dev”,“comments”: {}}

But i am getting issue while passing this as an input, Please anyone help me to resolve this issue.

Regards,
Sai

Hi Everyone,

Hope you are doing well. I would also like some help to format the body request I am using.

{“universe”:[“HK0000048691=TMKR”, “HK0000051406=TMKR”],“fields”:[“MATUR_DATE”]}

i have tried using double quotes but are still experiencing issues.

“{”“universe”“:[”“HK0000048691=TMKR”“, ““HK0000051406=TMKR””]”,““fields””:[““MATUR_DATE””]“}”

Hope someone can help me on this.

Thank you so much in advance!

I would recommend you to store the body response in a variable first and pass those variables to the keys accordingly. So every time when you will get a new result it will first be stored in variable and then they will be assigned to the keys.

@Bhaskar_Mukka

Please Make sure you have valid authentication, correct syntax and data, and all mandatory input parameters have been filled.

@encastillo2
Try by this way which I wrote below for you.
{“universe”:[“HK0000048691"=“TMKR”, “HK0000051406”="TMKR”],“fields”:[“MATUR_DATE”]}