How To Configure UiPath HTTP Request Activity For Form-Data Body?

How to configure the UiPath HTTP Request activity for a form-data Body?

Note: In the below example, a package is uploaded into UiPath Orchestrator Cloud, but it is recommended to readapt the example for your requirements.

In Postman, it is needed to use a form-data Body to upload (POST method) a .nupkg file to the Orchestrator.



In UiPath Studio, you need to configure the HTTP Request activity as below:

Enable SSL certificate verification: true

Timeout (milliseconds): 120000

AcceptFormat: ANY

Endpoint: "https://cloud.uipath.com/your_org_name/your_tenant_name/orchestrator_/odata/Processes/UiPath.Server.Configuration.OData.UploadPackage"

Method: POST

Attachments: file: "C:\Users\your_username\Downloads\0072_LIDL_Reifenprozess.1.0.90.nupkg"

BodyFormat: multipart/form-data

Headers: Authorization: "Bearer your_access_token"

Output

Result: out_Result (create a variable as Ctrl + k)

StatusCode: out_StatusCode (create a variable as Ctrl + k)

Results:

For a successful upload

Note: The HTTP 200 OK success status response code indicates that the request has succeeded.

For a failed upload

Note: The HTTP 409 Conflict response status code indicates a request conflict with the current state of the target resource.

----

Let's assume you need to use a form-data Body to upload (POST method) as it is presented in the below example:

On trying to add the key/value pairs as multiple Strings in the Options -> Attachments in your HTTP Request activity, an error such as 415 (Unsupported Media Type) is thrown. In this case, try to add the needed key/value pairs as multiple Strings in the Options -> Parameters section of your HTTP Request activity.

Note: The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in unsupported format.

1 Like