Sirportly

Toggle Menu

Uploading Attachments

This method allows you to upload attachments to existing ticket updates. You should first create your ticket update and then upload any attachments to it using this method.

URL

/api/v2/tickets/add_attachment

Access

This method can be accessed by account tokens and user tokens where the associated user has access to the tickets UI.

Supported Parameters

  • file - an uploaded file (required)
  • content_type - the content type for the uploaded file (optional)
  • filename - the filename for the file (optional)

If you wish to link the attachment which a ticket update which already exists. You can pass the following methods. If these are not provided, the attachment will be created temporarily on the server and you will be provided with a token which can be used to link it with a new ticket update (temporary_token).

  • ticket - the reference of the ticket you wish to add the attachment to (required)
  • update - the numeric ID for the update which you wish to assign the attachment to (required)

Example Usage

If you wanted to execute this using curl, you could use the command below:

curl https://api.sirportly.com/api/v2/tickets/add_attachment /
     -H "X-Auth-Token:example" -H "X-Auth-Secret:example" /
     -F "ticket=GJ-060309" -F "update=26" -F file=@/Users/adam/Desktop/signups.xls /
     -F "content_type=application/vnd.ms-office"

Returned Data

If the attachment is added successfully you'll receive a 201 Created status with information about the attachment. If it fails, you'll receive a 422 Unprocessable Entity status with information about the errors encountered.

Example JSON

{
    "id": 6,
    "name": "Anna's Sigature.png",
    "content_type": "image/png",
    "file_size": 111088,
    "extension": "png",
    "disposition": "inline",
    "temporary_token": "bca421bd-5a9d-49ea-b69c-bc7b74185cc9",
    "temporary_token_expires_at": "2013-03-03T14:07:49Z"
}