Http Request Code Where to add it?

I’m trying to figure out how to use the HTTP Request activity. I’m trying to send out a request and get some information returned. Where in the activity would I add the request code? I have entered the endpoint, and my authorization credentials. Below is the request code I’m just not sure where or how i would add this to the http activity. Some help would be appreciated.

{

“quotebackId”: “Plan P Branded”,

“subCustomerId”: “V04”,

“permissibleUsage”: “IN”,

“requestType”: “P”,

“request”: [

{

“requestId”: “1”,

“licensePlate”: “7733XP”,

“licenseState”: “FL”

}

],

“requestPlate”: “Y”,

“requestBranded”: “N”

}

Install uipath.web.activities
there you can find http request activity
give the end point url
select the type of method you are using get,put post or delete
and in the headers you can give the bearer authentication token
and the parameters you can can add all the query paramerters and url parameters

Sandhy,
I have the activity, im just nor sure how to use the the code in the above thread into the activity to request that information, like I would in postman. I’m new to API calls.

in the properties enter the json into body
make sure you change the format as JSON

Sandhya,


In the body I added the code to request the information and changed the BodyFormat to JSON. Is this correct?

Yes!!

Im getting an error in the expression editor. Can this activity handle multi line coding for a request?

yes the body part can be multiline
just like postmaster you can add multiline in the body.
did you try to get the response using pastmaster??

I got the response using post master. the error I’m getting in the Expression Editor is "Compiler Errors encountered Processing Expression ‘}’ Expected.

Here is the code i added in the expression, they have a red dot, so maybe my code is in correct? this code works in postman when i sent it out. Is there a way to add code from a vb. net file? In postman i just imported a vb.net file that had the request code and it worked just fine.
Errors

I’m afraid you will have to put it on one line and escape each double quote mark with another double quote, try this:

"{ ""quotebackId"":""Plan P Branded"", ""subCustomerId"":""V04"", ""permissibleUsage"":""IN"", ""requestType"":""P"", ""request"":[ { ""requestId"":""1"", ""licensePlate"":""7733XP"", ""licenseState"":""FL"" } ], ""requestPlate"":""Y"", ""requestBranded"":""N""}"

Maciej,
Nice work! I no longer have the error, I have been battling with that issue for the last week and i was thinking that it had to be in only one line with all the research I have done. I haven’t done API calls before so this is all new. How would you suggest that I get the results once I run it? Using the Output properties of the activity. Do you have a simple workflow by any chance?

There is a Result property that returns the API call output as a string. If the string is actually a JSON file, you can parse it using the Deserialize JSON activity.

The easiest starting point is to print the Result output using a Write Line activity and go from there.

Feel free to browse other topics on how to parse the string to JSON in case it is not clear :slight_smile: There is a lot of examples here.

Maciej,
Thank you, I have been fighting with this for weeks.

Maciej,
I made a workflow and some variables but im getting the attached error in the output panel, and ideas?


Maciej
Here is the attached error

Could you add a Write Line activity right after the HTTP Request with this in it, then run it and post the output from the Output panel?

TEST.ToString

Maciej,
I ran it like you suggested and the output panel came up with nothing.

This could mean that the request is not properly processed. Feel free to assign a variable to the StatusCode and print it out as well.

Even simpler, if you start a debugging with a Step Into button, you will be able to see before and after result of executing the activity. This might give you some clues as to what is going wrong here.

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