Uploading a file attachment

On this page

Use this API method to upload a file in Jira for being used later to create a document of File type. The result is in JSON format and contains the ID of temporary file uploaded in Jira.

This API method will not create a document of type File in Documents. It is just the first step for the process of creating such a document. See Creating a new document or folder section.

Request URL

The request URL takes the following form:
POST <ROOT>/rest/stonikbyte-documents-api/1.0/temporary-attachment?filename={fileName}&projectId=(projectID}&atl_token={atlToken}

Parameters

Parameter

Description

Parameter

Description

filename

The name of the file attached.

projectId

The id of the Jira project where the document will be created

atl_token

The upload token. To obtain the token, see Obtaining the Upload Tokensection

Make sure to set these header parameters:

Parameter

Value

Parameter

Value

X-Atlassian-Token

no-check

Content-Type

multipart/form-data;boundary={your_boundary}

Also, the form-data content of the request must contain as binary data the file to be uploaded.

A successful response

An HTTP 201(Created) status response indicates a successful request. The result in JSON format will contain the ID of the temporary attached file that you can use to create a new document of type File. SeeCreating a new document or folder section.

{ "name": "myfile.txt", "id": "7214177218780006431" }

Error Response

If the REST call fails, the service returns one of the following HTTP statuses:

HTTP Status Code

Description

HTTP Status Code

Description

401 Unauthorized

Returned for unauthenticated requests or in case of invalid Documents app license

403 Forbidden

If the user does not have Create or Edit permissions in the Documents app

400 Bad Request

In case of invalid parameters.

Â