Creates a resumable upload (tus protocol): the first step to upload a file.
Required role: ORG_VIEWER, to upload documents (DOCUMENT) only, or ORG_EDITOR for all file types. The organization path parameter must be the organization of the access token.
Headers
| Header | Required | Description |
|---|---|---|
Tus-Resumable | Yes | 1.0.0 |
Upload-Length | Yes | Size of the file, in bytes |
Upload-Metadata | Yes | The metadata below, as comma-separated key value pairs, each value encoded in Base64 |
Metadata (Upload-Metadata)
Upload-Metadata)| Key | Required | Description |
|---|---|---|
filename | Yes | Name of the file, with its extension. Executable files (.exe, .msi, .bat, .sh, .js, .dll, ...) are refused. |
JMC-fileType | Yes | VECTOR_DATA, RASTER_DATA or TABULAR_DATA (data to import as a data source), DOCUMENT (attachment of a feature or row) or MEDIA (image of a project presentation page) |
JMC-partNumber | No | For a file made of several files (see below): {part}_of_{total}, such as 1_of_3 |
JMC-partId | No | For the other parts of a file made of several files: the JMC-partId returned for the first part |
JMC-containerType | No | GDB, for the files of an Esri File Geodatabase folder (VECTOR_DATA only) |
JMC-containerName | No | With JMC-containerType: the name of the folder, such as parcels.gdb |
For example, filename myData.zip and JMC-fileType VECTOR_DATA are sent as:
Upload-Metadata: filename bXlEYXRhLnppcA==,JMC-fileType VkVDVE9SX0RBVEE=
Files made of several files
A data set made of several files (such as a shapefile's .shp, .dbf, .shx and .prj, or an image and its world file) can be uploaded as several uploads instead of a ZIP file:
- send
JMC-partNumber(1_of_4,2_of_4, ...) with each part; - the response to the first part has a
JMC-partIdheader: send it asJMC-partIdwith the other parts.
When all the parts are uploaded, they become one file whose id is the JMC-partId, and it is analyzed.
How to upload a file
Uploads follow the tus 1.0.0 resumable upload protocol: any tus client (such as tus-js-client) can be used, with the access token in its headers.
POST .../uploadcreates the upload: the response is201with its URL in theLocationheader,.../upload/{fileId}.fileIdis the id of the file in this service.PATCH .../upload/{fileId}sends the content, in one request or in several chunks.- To resume an interrupted upload,
HEAD .../upload/{fileId}returns the number of bytes received inUpload-Offset: send the rest from there.
Follow the file with GET .../files/{fileId} (see its status). An upload that isn't completed within 2 days expires.
After the upload
The file is scanned for threats (THREAT_DETECTED; a file that can't be scanned is refused: ERROR), then stored (UPLOADED). Data files (VECTOR_DATA, RASTER_DATA, TABULAR_DATA) are then analyzed by a job of the process service (jobId), and deleted after 10 days: create the data source from them before.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
201The upload was created: its URL is in the Location header (empty body). For the first part of a file made of several files, the JMC-partId header is the id to send with the other parts.
412Tus-Resumable is not 1.0.0