How To Use HTTP Request Activity To Update A Klipfolio Data Source Using A CSV File?

How to use HTTP Request activity to update a Klipfolio Data Source using a CSV file?

How to use HTTP Request activity to update a Klipfolio Data Source using a CSV file?

Consider a Data Source from a CSV file, to update it using the HTTP Request activity.

1.jpg

  1. To achieve that, firstly create an API Key for user in the Klipfolio portal.
  • For this go to Users -> About User -> Edit

2.jpg

  1. Then click on Generate New API Key -> Save (the generated API Key needs to be used afterward for authentication)

3.jpg

  1. Modify the CSV file (in this example we added an extra row)

  1. Basically, in UiPath project, replicate the steps from a successful test in the Postman application

Headers


Body and Results

image.png

UiPath Studio Project Configuration (the below steps were tested in a Windows-Legacy project)

In order to perform a PUT request for https://app.klipfolio.com/api/1/datasource-instances/YOUR_DATA_SOURCE_ID/data , perform these steps in the UiPath project.

  • Use the Manage Packages ribbon and add UiPath.WebAPI.Activities package

  • In the project, try to use Modern Design Experience as will help you to easier design and configure the project (you will have some behaviors like in UiPath Studio X)

  • Add a Read CSV activity and configure it as below5.jpg

  • Add an Output Data Table and configure it as below

  • Add an HTTP Request activity and configure it as below

Enable SSL certificate verification: True

Timeout (milliseconds): 10000

Accept Format: ANY

Request Method: PUT

Request URL: "https://app.klipfolio.com/api/1/datasource-instances/YOUR_DATA_SOURCE_ID/data"

Body: out_DataTable_To_Text

Body Format: text/csv

Headers:

kf-api-key: "YOUR_GENERATED_API_KEY"

Content-Type: "text/csv"

Output

Headers: out_headers

Response content: out_response_content

Response status: out_response_status

  • For debugging purposes add a Log Message activity

"Response: " + out_response_status.ToString + vbCr + "Response Content: " + out_response_content.ToString

6.jpg

  • Results in your updated Klifolio Data Source

7.jpg