HTTP Post Request error

Hello All,

I am getting response as

‘{“data”:{“status”:{“isSuccess”:false,“message”:“Incorrect Request1”,“statusCode”:“1”}}}’

I need to send Body data as follows:

{
   "webServiceReq":{
      "channelId":"RPA",
      "cifId":"123456789",
                      "serReqId":"getlist",
                      "requestUUID":"12345678",
                      "request":
                                        {
                                                            "custId":"0122345678"
                                        }                  
      }
}

Any help will be appreciated.

Thanks

Hi,

Check whether the service is working properly using SoapUI, then try to make the same request from your UiPath activities. Post your sample xaml will help us to provide correct info on your issue.

@sarathi125 Thanks for Reply

The request is working properly in Postman.

And I am trying to send the same request in UI Path.

Could you please guide me to format with the above Body data ?

Hi @sarathi125,

Please find the attached .XAML file.

Please note that end url is not added in this becuase of security reasons.

Please let me know what needs to change?

ThanksAPI_Test.xaml (8.2 KB)

Hi,

Refer this link,


it has all the details, still need any assistance let me know

@sarathi125

Thanks for reply

But I am using simple HTTP reuqest

Could you please confirm that I am sending Body data is in correct format or not?

Really big thanks for your helpAPI_Test.xaml (8.2 KB)

Hi,

When I am tying to open the xaml, I am getting this error
Could not find type ‘HttpClient’ in namespace ‘http://schemas.uipath.com/workflow/activities’. Row: 63, Column: 10

Please find the zip fileAPI_Test.zip (1.9 KB)

same error only.

Hi Sarathi ,

one question.

Is following syntax is correct for HTTP Request Body?

{
   "webServiceReq":{
      "channelId":"RPA",
      "cifId":"123456789",
                      "serReqId":"getlist",
                      "requestUUID":"12345678",
                      "request":
                                        {
                                                            "custId":"0122345678"
                                        }                  
      }
}

Build your request using the http request builder and check whether that is working or not, I am not sure from where your are building the request body you are mentioning here

@sarathi125

Hello Sarthi,

Please find the attached updated .xaml files.

Could you please have look on it .

ThanksHTTP API Test.zip (3.2 KB)

Hi @Rahul_S,

Am not sure whether you were able to resolve the issue.
But the spaces in the body are not supported by UiPath as valid.
Also, double quotes are supposed to be escaped by double quotes to ensure they are consumed as them.
So the required format should be:
“{”“webServiceReq”":{"“channelId”":"“RPA”",…}"

Thanks!

1 Like

@sarathi125 @Akanksha_Varshney
Thanks a lot for you support.

I have solved this one.
Thanks
Rahul

Hi @Rahul_S,

Could you please let us know how you solved it?
I am facing below error:
“Error: Request is not a valid JSON”

Thanks!

Hi

I have Composed Body data in following format:

> "{""filedata"":""data:image/jpeg;base64,"+abc+""",""filename"":""1234.pdf"",""doc_name"":""abc""}"

Hope you got this.

Or else please send body format you are following

Thanks
Rahul

Hi @Rahul_S ,

Following are the formats that I tried, and they seem same as what you are using
(Diff between the two is one uses single quotes and the other uses double quotes - none of them seem to be working for me!)
“{“‘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”‘}”

or

“{““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”“:”“av@av.com”“}”

Thanks!

@Akanksha_Varshney

Could you please send Normal Body format without all those double quotes which you are using in Postman?

I will format it in proper way and will revert back to you.

Thanks @Rahul_S for helping out!

Tried with following formats, get the same error:
“{‘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’}”

“{“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”}”

Following is the Postman body:
{
“default_phone_number”:null,
“password”: “qwer1234”,
“email”:"av2@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”:"av2@avtest.com"
}

@Akanksha_Varshney

Please try below format same as it is in Body

“{”“default_phone_number”":"“null”","“password”": ““qwer1234"”,”“email”":""av2@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”":"“av2@avtest.com”"}"

Please find the attached workflow for your reference.

Hope it will help.

HTTP Request.xaml (7.2 KB)