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 specific requirements.

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

image.png



In UiPath Studio, 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_----------------prozess.1.0.90.nupkg"

image.png

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
image.png

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 a form-data Body is needed 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 the HTTP Request activity, an error such as 415 (Unsupported Media Type) is thrown. In this case, try adding the needed key/value pairs as multiple Strings in the Options -> Parameters section of the 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