Uploading Attachments
You can upload files to include with a ticket update or project file creation. If the uploaded image is detected as an image (GIF, JPG or PNG) we'll display it in the web interface.
API URLs
Data | Method | URL |
Upload a file to your account | POST | /uploads |
Object Properties
POST /uploads
<uploads>
<upload>
<id>123456</id>
<identifier>c2959f1c-0297-0af7-4e52-ed0bc3e2fb02</identifier>
<file-name>upload.gif</file-name>
<content-type>image/gif</content-type>
<file-size>34353</file-size>
<url>https://account.codebasehq.com/uploads/identifier</url>
</upload>
</uploads>
You should upload your attachment as a multipart-form, name the file parameter files[]
. You can upload multiple files at once by specifying many files[]
parameters.
identifier
should be used for adding this attachment to a ticket or a project file. Use in theupload-tokens
array when creating these objects.
Example for adding an attachment using curl
curl http://api3.codebasehq.com/uploads.xml \
-u "account/user:api_key" \
-F "files[]=@path/to/file/to/upload.gif;type=image/gif" \
-F "files[]=@another/file/to/upload2.gif;type=image/png""
If the request is successful, you'll receive a 200 OK
with properties for the attachment, otherwise a 422 Unprocessable Entity
.