After reading through tons of posts on REST API calls on the forum, still unable to figure out a reason for the error am facing.
Am trying to POST a REST request and the workflow looks like as below:
After going through many posts here, have tried with following values in the Body part till now:
Single Quotes:
“{“‘default_phone_number”‘:null,”‘password”‘: “‘1234”‘,”‘email”‘:”‘av@av.com”‘,”‘first_name”‘:”‘Joe”‘,”‘is_admin”‘: True,”‘last_name”‘:”‘Admin”‘,”‘permissions”‘:{“‘edit_apps”‘:True,”‘edit_cc_users”‘:True,”‘edit_data”‘:True,”‘edit_web_users”‘:True,”‘view_report_list”‘:,”‘view_reports”‘:True},”‘phone_numbers”‘:,”‘role”‘:”‘Admin”‘,”‘username”‘:”‘av2@av.com”‘}”
Only Single Quotes:
“{‘default_phone_number’:null,’password’: ‘qwer1234’,’email’:’av1@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’:’av1@avtest.com’}”
All yield same error: “Error: Request is not valid JSON” Status Code: 400
Thanks for looking into, @Akash_N_Jain!
I looked into the formatter and it gives same error for all the three varieties " [Strings should be wrapped in double quotes.](javascript:;)"
Also, the format in which UiPath accepts the JSON is different from normal JSON format. Any way to validate the former?
I observed lot of random quotation marks used in JSON. When you try to validate the JSON on online please follow the error message that it shows which will help you in resolving the same.
@Akanksha_Varshney
Hi. Don’t know if this helps, but sometimes when you copy text with quotations it copies a different character for the quotation marks and so it doesn’t work in UiPath. Try replacing all the quotation marks manually, because it should create “strings” in colored text within the Expression editor.
Hey @roma.sodha,
Yes, I was able to solve this by putting the whole JSON in a JSON file and reading the same. Reading an external makes it convenient for UiPath to figure out the best way to deal with quotes.
Let me know in case of further questions.
Thanks!
I am trying to put a filter in the body of the request. unfortunately, its not working for me. so far I tried double quotes 2x and single quotes. I just discovered this post about creating the json file. Did you put the file path of the json file in the request body field?