Sending Output data to an API

Hi Friends/Experts,

Can you please help with below requirement .

After running my bot I am getting data in output file (excel sheet)

URL USERID Password Login Start Time Login End Time Status

I need to send this data to a monitoring tool called New Relic where it will be displayed in a dashboard .

New Relic team has provided me an API URL.

Can you please help me , how to send output data to an API ?

Thanks ,
Niraj

1 Like

Can you check what type of request you need to do to send the data and also Can you check how you need to send the data to the server? we have multiple options to do that, like sending the attachment directly or sending the data in the body of the post request or as query params…

Hey Niraj,

Calls to web APIs are often handled by UiPath developers using the “HTTP Request” activity which you will find in the “UiPath.Web.Activities” package.

Self help for using this activity can be found here: https://docs.uipath.com/activities/docs/http-client

In order to assist you with creating the necessary request with your Worksheet data, you’ll have to provide the information @HareeshMR requested - what is the type & expected format of the API endpoint you will be sending your request to?

New Relic Monitoring team has provided me an API and curl command .

As per the requirement I need to send my output file data to API .

Hi Hareesh,
I would like to do the same, i want to send the data in the body of the post request.
Can you share an example.
It would be helpful.
My bot will return me list of text records and i want to send this data further in api.

Regards,
Manish

Can you let me know the format of the body that needs to be sent in the request?

Its going to be simple text.
Now i am able to do that, but there is one problem when i send the text in body it automatically converted into html.
but when i used the same api with postman its working fine.
Regards,
Manish

Can you post the screenshots of both UiPath and postman how you are sending the request @Manish_Jawla?

Are you sure you are passing the header Accept in the request?

Hi Hareesh,
I am just sending the text string and in result i am appending the another string “well done”

above is postman respone which is correct.
in the below u can see that my input string got converted into html:
image

I hope you are passing the value as query parameter, so it is converting the space as %20. You can replace that after getting the response @Manish_Jawla. Do replacing affect the process?

No Hareesh, but i am worrying in case i have received lot of special symbols then for each and everyone, i need to do the conversion because i am gona receive huge text as input.
Regards,
Manish

I hope this won’t cause if you pass the accept header as text @Manish_Jawla. Can you please try that once again passing the accept header as text/plain

HI Hareesh,
I am passing it in body not in header because this is the api exposed by me to get the data from ui path and then i will process it at my end.
Regards,
Manish Jawla

Yeah, I understand, but the response you are going to get needs to be in the format right? If you pass the header as content type, it indicates the type of input you are passing to the request in body and accept indicates the type of response you are going to get. So, I’m asking you try passing that header :slight_smile:

HI Hareesh,

I did the same but still getting the same response.
image

Could you please try sending the header Accept as well @Manish_Jawla?

1 Like

Thanks Hareesh, It worked :slight_smile:

1 Like

Hi
Im working on a project where I need to migrate the data from one website to other.
and create an API for that data.
Can anyone suggest me how to proceed further?

I have scrapped the requested data and converted to the Json, now I need to convert the scrapped data to API.
Can anyone help me with the process

I don’t understand what are you trying to do

As you have API, you can use HTTP activity to send the request directly and get the output which is available when you install the package UiPath.web.activities .

Have you tried this?