Create Ticket Attachment Token

Issues a token for uploading a ticket attachment. Send the file data to the Upload File endpoint with the issued token. Once the upload finishes, the same token value becomes the GUID of the attachment. Pass that GUID as file_guid to the Create Ticket Attachment endpoint to attach the file to a ticket. To abort the upload, remove the token with the Cancel Ticket Attachment Token endpoint.

Required Permissions

Available to any authenticated user.

HTTP Request

POST /api/sonar/ticket-attachment-tokens
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d 'file_name=report.pdf' \
     -X POST \
     https://HOSTNAME/api/sonar/ticket-attachment-tokens
Request Parameters
KeyRequiredTypeDescriptionNote
file_nameYesStringName of the file to upload

Success Response

{
  "token": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
  • token (String): Issued file upload token. Pass it to the Upload File endpoint. Once the upload finishes, this token value becomes the GUID of the attachment. A 36-character GUID.

Error Responses

File name is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "file_name should be not null"
}