Upload repository content

put/repository/items/{itemId}/content

Uploads a single file to create a new file or updates the content of an existing file. You can also upload and expand a ZIP file to a container.

If the itemId is for a file, the content of the file is updated. If the file is versioned, a new version is added. Otherwise, the content is overwritten.

If the itemId is for a container, a single file can be uploaded or uploaded and expanded if the upload file is a ZIP file.

When uploading a file to a container, if a name is not provided, the API will attempt to use the name of the file on the multipart request. If a file does not exist with that name, the file is created. By default, the file is created unversioned. Optionally, version information can be specified to create the file as versioned. If a file with that name exists, a new version is added if the file is versioned; otherwise, the content is overwritten. When upload and expanding, the same rules apply to files and any folders that do not exist are created.

Optionally, an action status ID can be provided to monitor the completion status. To get the action status ID, first call [batchUpdate](#operationId:batchUpdate) with the action UPLOAD or UPLOAD_EXPAND, which returns the action status ID on the request header.

Authorization: Requires write permission on any upload locations. If versioning is specified, the Enable Versioning and/or Manage Versioning privilege is required when creating files.

Request Samples

1

Response Samples

1{
2 "value": {
3 "version": 1,
4 "createdBy": "sastest1",
5 "creationTimeStamp": "2023-08-29T12:23:24Z",
6 "modifiedBy": "sastest1",
7 "modifiedTimeStamp": "2023-09-19T19:01:21Z",
8 "id": "cac68a83-2f9b-4e45-859f-1163581edf1e",
9 "typeId": "businessunit",
10 "createdByDisplayName": "SAS Test User 1 (sastest1)",
11 "modifiedByDisplayName": "SAS Test User 1 (sastest1)",
12 "primaryType": "CONTEXT",
13 "name": "BU",
14 "location": "/",
15 "path": "/BU",
16 "size": 5318049,
17 "propertiesModifiedTimeStamp": "2023-08-29T12:23:24Z",
18 "propertiesModifiedBy": "sastest1",
19 "propertiesModifiedByDisplayName": "SAS Test User 1 (sastest1)",
20 "state": "ACTIVE",
21 "owner": "sastest1",
22 "ownerDisplayName": "SAS Test User 1 (sastest1)",
23 "syncable": "ALLOW",
24 "defaultOwner": "sastest1",
25 "defaultOwnerDisplayName": "SAS Test User 1 (sastest1)",
26 "defaultMajorVersionLimit": 5,
27 "defaultMinorVersionLimit": 10,
28 "tags": []
29 }
30}

Path Parameters

NameTypeRequiredDescription
itemId
string
true

The unique identifier for the repository item.

Query Parameters

NameTypeRequiredDescription
actionStatusId
string
false

The action status ID for monitoring the completion status. The action status ID is obtained by calling batchUpdate with the action UPLOAD or UPLOAD_EXPAND.

comment
string
false

The file version comment for this newly created repository file. If a context or folder is being created this parameter will be ignored.

expand
boolean
false

Determines if the ZIP file on the request should be expanded when it is uploaded to the repository container. This parameter is ignored if the itemId is for a file.

fileVersion
string
false

The version specification for creating a version of the file. This parameter is not required, so unless a version parameter value is provided, the file is created un-versioned. The valid values for version are MAJOR, MINOR, or a specific version such as 2.3. If MAJOR, the file is created as versioned with initial version 1.0. Similarly, MINOR creates a versioned file with version 0.1. If the file exists and is versioned, new versions are MINOR versions by default. To specify a version other than MAJOR or MINOR, a value can be specified between 0.1 and 99999.99999. If a context or folder is being created, this parameter is ignored.

name
string
false

The name of the file to be created or updated.

Request Body

NameTypeRequiredDescription
filename
string
false

The name of the file. Clients must specify name of the file as form data in the request body.

file
string
false

The actual file content. The content should be listed in the format of standard form data in the request body. Only one file is permitted in a multipart request.

Responses

StatusMeaningDescription
200OK

Content was uploaded successfully.

HeadersSchema
400Bad Request

Bad Request

404Not Found

Not found - the repository item could not be found.