How to post data using HTTP request in body parameter

Hi Team ,

I want to post data in Jason format using Http request in body parameter .
I have sent data successfully while hard code the value/query in body .
“{”“RFC_Dest”“: “””+in_Dest+“”“,”“Action”“: ““Double transmission is possible””}”
Response :-201 .

Unable to send the data using same query need to read value from asset .

Can some one please help on this .How we can post the data using http request in body from Asset value .

let us summarize our understanding.

  • the hardcoded JSON string was working
  • then you moved the string to an asset, but it is failing
    rigth?

ensure that you handle properly the variable substitution. It cannot be done, when the same string is stored as string value on the asset.

Maybe following will work

Asset Value: {{'RFC_Dest': '{0}' , 'Action': 'Double transmission is possible'}}

Statement for the Body Field:
String.Format(in_Config("Query").toString, in_Dest)

I tried to with above solution but facing some issue .



.
Can you please guide on this peter

Thanks .

we would suggest to set a breakpoint and debug it. Once you get paused then use the immediate panel and prototype it

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

it looks that some variables / parameters are missmatched, but all can bechedked and tested within the debugging session

Hi peter,

I have tried in multiple always but doesn’t help .

Can you please help .

Thanks ,
Suresh

just show us the immediate panel output from the different variables and its values which are involved when setting up the String.Format(… line

Asset value is this


Thanks,
Suresh

we would recommend:

  • Check on all scopes that there are not multiple variables with the same name (strqueryvalue)

Do in the tests within the immediate panel each test and do it complete

we miss here:

  • String.Format(Str_Query, Action)
  • in_Config(“HTTPRequestBody”).toString
  • String.Format(in_Config(“HTTPRequestBody”).toString, Action)

Also, we would recommend:

  • do clean up and remove all unneeded vars (e.g Str_Query) when it is not used e.g. within String.Format
  • instead of creating variables/logs, … do the inspections consequently within the immediate panels.

It looks like there is only a small confusion within your code and that you are close to having it done.

Feel free to share your XAML with us

Pl find the XAML file .
Can you please check peter .

Main.zip (2.0 KB)

Thanks ,
Suresh.T

@Thumu_Suresh
perfect that you isolated the issue
we need to escape { } when we need it as char in the pattern text

grafik
"{{'RFC_Dest':'{0}' , 'Action': 'Double transmission is possible'}}"

Now it is working Peter .
Thanks for the help…!!!

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