FileDownload

Use this resource to download a file that is attached to a process, an instance, or a comment.

Method summary

HTTP Method Path Description
GET /scr/api/FileDownload Downloads a file that is attached to a process, an instance, or a comment.

GET/scr/api/FileDownload

Description
Use this method to download a file that is attached to a process, an instance, or a comment.
Resource information
Requirements Description
Response format Raw data for the file in the same format it was uploaded in.
Requires authentication Yes. The user must have at least access to the process, instance, or post to which the file is attached. If a file is attached to a post that is not posted yet or to an instance that is not started yet, the file can be downloaded only by the user who uploaded it.
Supports OAuth 2 client credentials Yes using a User Service ID containing Artifact Reporting Category
Rate limited Not yet
Parameters
The user must provide one of the following parameters to specify an object that the file is attached to:
  • processId
  • instanceId
  • postId
If the file is attached to a post that is not posted yet or an instance that is not started yet, then the user is not required to provide the postId or instanceId.
Name Location Description Required Type
X-On-Behalf-Of Header The user context. The value must be a username in the account. The user must have permission to perform the action in the account and in the specified parent space, if any. Required if Service ID OAuth credentials are used. Not required when using User Service ID OAuth credential. String
fileItemId Query The ID of the file item to download. This parameter is returned as a property of the response from FileUpload, ProcessData, WorkDetail, or AppDetail responses. For FileUpload, WorkDetail, and AppDetail, the value to be used is in the id field. For ProcessData, the value corresponds to the key in the files dictionary. Yes String
instanceId Query The ID of the instance that the file is attached to. Yes, if the downloaded file is attached to an instance. String
postId Query The ID of the post that the file is attached to. Yes, if the downloaded file is attached to a post. String
processId Query The ID of the process that contains an activity with the file attachment. Yes, if the downloaded file is attached to a process. String
Response
The data from the file.
Example input
  • Using User Service ID OAuth 2 client credentials:
    curl -i -H "Authorization: Bearer access_token" 
        "https://your_server_url/scr/api/FileDownload?fileItemId=9042b"
  • Using Service ID OAuth 2 client credentials:
    curl -i -H "Authorization: Bearer access_token" 
        "https://your_server_url/scr/api/FileDownload?fileItemId=9042b"
  • Using Service ID OAuth 2 client credentials with user context:
    curl -i -H "Authorization: Bearer access_token" -H "X-On-Behalf-Of:user_name@domain.com" 
        "https://your_server_url/scr/api/FileDownload?fileItemId=9042b"
Example output
File data
Response properties
None
Response messages
HTTP code Reason
400 Bad request. See the response body for more information.
401

The user isn't authorized to make the request.

403 The user does not have access to the process, instance, or post that the file is attached to.