Orchestrator
latest
false
Banner background image
Orchestrator API Guide
Last updated Mar 21, 2024

Storage Bucket Requests

Add a File to a Storage Bucket

Uploading files to an existing storage bucket using Orchestrator APIs is a two-part process:

  • First you need to call the GET /odata/Buckets({key})/UiPath.Server.Configuration.OData.GetWriteUri endpoint, that returns an URI and the HTTP method as a response.
  • Then you need to use the HTTP method from the GET response to call the {URI} endpoint, attach the file you want to upload in binary format, and send it to the URI obtained from the GET request.

GET Endpoint

GET https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/Buckets({key})/UiPath.Server.Configuration.OData.GetWriteUri
To find out the URI and the HTTP verb, you need to upload the file to an existing storage bucket, then make a GET request to /odata/Buckets({key})/UiPath.Server.Configuration.OData.GetWriteUri.

Provide the following parameters and headers:

Path Parameters

Path param

Data type

Description

key

(required)

String

The ID of the storage bucket where you want to upload your file.

Query Parameters

Param

Data type

Description

path

(required)

String

The name of the file you want to upload, together with its extension.

For example, "my_file.txt".

contentType

(required)

String

The content type for the file extension.

For example, the content type of .txt extensions is text/plain.

Request Headers

--header 'Authorization: Bearer {access_token}'\
--header 'Content-Type: application/json' \
--header 'X-UIPATH-OrganizationUnitId: {the_ID_of_the_folder_that_contains_the_storage_bucket}' \--header 'Authorization: Bearer {access_token}'\
--header 'Content-Type: application/json' \
--header 'X-UIPATH-OrganizationUnitId: {the_ID_of_the_folder_that_contains_the_storage_bucket}' \
The X-UIPATH-OrganizationUnitId is the ID of the folder that contains the storage bucket.

Example Request

curl --location --request GET 'https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/Buckets(28053)/UiPath.Server.Configuration.OData.GetWriteUri?path=my_file.txt&contentType=text/plain' \
--header 'x-uipath-organizationunitid: 3991326' \
--header 'Authorization: Bearer 1234'curl --location --request GET 'https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/Buckets(28053)/UiPath.Server.Configuration.OData.GetWriteUri?path=my_file.txt&contentType=text/plain' \
--header 'x-uipath-organizationunitid: 3991326' \
--header 'Authorization: Bearer 1234'
The access token in the example is 1234 for length considerations.

Response Body

The response body contains the URI and the HTTP verb required to upload the file to the storage bucket in binary format.

{
    "@odata.context": "https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/$metadata#UiPath.Server.Configuration.OData.BlobFileAccessDto",
    "Uri": "https://cr.blob.core.windows.net/orchestrator-4871-905f/BlobFilePersistence/2760e0fe-0fa7/my_file.txt?sv=2021-08-06&st=2023-01-13T16%3A32%3A12Z&se=2023-01-13T17%3A32%3A42Z&sr=b&sp=cw&sig=xB3W02xGYHfw%3D",
    "Verb": "PUT",
    "Headers": {
        "Keys": [
            "x-ms-blob-type"
        ],
        "Values": [
            "BlockBlob"
        ]
    }
}{
    "@odata.context": "https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/$metadata#UiPath.Server.Configuration.OData.BlobFileAccessDto",
    "Uri": "https://cr.blob.core.windows.net/orchestrator-4871-905f/BlobFilePersistence/2760e0fe-0fa7/my_file.txt?sv=2021-08-06&st=2023-01-13T16%3A32%3A12Z&se=2023-01-13T17%3A32%3A42Z&sr=b&sp=cw&sig=xB3W02xGYHfw%3D",
    "Verb": "PUT",
    "Headers": {
        "Keys": [
            "x-ms-blob-type"
        ],
        "Values": [
            "BlockBlob"
        ]
    }
}

PUT Endpoint

PUT {URI}

The URI is the value of the "Uri" key from the response body.

Request Headers

--header 'x-ms-blob-type: BlockBlob' \
--header 'Content-Type: text/plain'--header 'x-ms-blob-type: BlockBlob' \
--header 'Content-Type: text/plain'
Note:
  • Make sure to include the headers you receive in the GET response body, and assign values to them. For example, for Azure Blob Storage, the returned header is x-ms-blob-type-header, which uses the BlockBlob value.
  • Do not use an authorization header with this request.

Request Body

Upload the file in binary format. You must use the same file you used as a query parameter in the GET request. In this case, "my_file.txt".

--data-binary '@/C:/Users/adam.eve/OneDrive/Documents/my_file.txt'--data-binary '@/C:/Users/adam.eve/OneDrive/Documents/my_file.txt'

Example Request

Let's say you gathered all the information needed to build the API call.

curl --location --request PUT 'https://cr.blob.core.windows.net/orchestrator-4871-905f/BlobFilePersistence/2760e0fe-0fa7/my_file.txt?sv=2021-08-06&st=2023-01-13T16%3A32%3A12Z&se=2023-01-13T17%3A32%3A42Z&sr=b&sp=cw&sig=xB3W02xGYHfw%3D' \
--header 'x-ms-blob-type: BlockBlob' \
--header 'Content-Type: text/plain' \
--data-binary '@/C:/Users/adam.eve/OneDrive/Documents/my_file.txt'curl --location --request PUT 'https://cr.blob.core.windows.net/orchestrator-4871-905f/BlobFilePersistence/2760e0fe-0fa7/my_file.txt?sv=2021-08-06&st=2023-01-13T16%3A32%3A12Z&se=2023-01-13T17%3A32%3A42Z&sr=b&sp=cw&sig=xB3W02xGYHfw%3D' \
--header 'x-ms-blob-type: BlockBlob' \
--header 'Content-Type: text/plain' \
--data-binary '@/C:/Users/adam.eve/OneDrive/Documents/my_file.txt'

In the Orchestrator UI, the file is visible in your storage bucket.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.