UiPath Documentation
orchestrator
2023.4
false
Orchestrator API guide

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.
Note:

External applications must include the OR.Administration scope in order to upload files to an existing storage bucket. This scope provides the storage permissions needed for upload operations.

GET endpoint​

GET https://{yourDomain}/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 paramData typeDescription
key

(required)
StringThe ID of the storage bucket where you want to upload your file.

Query parameters​

ParamData typeDescription
path

(required)
StringThe name of the file you want to upload, together with its extension.

For example, "my_file.txt".
contentType

(required)
StringThe 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://{yourDomain}/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://{yourDomain}/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://{yourDomain}/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://{yourDomain}/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?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated