Uploading files
Uploading a file is done in two steps.
- Upload / store the file. This will give you a reference ID.
- Attach the file to something, e.g. a deal, by giving the reference ID.
Note: both steps have exceptional request and response structures.
Step 1
First you must send a POST
to https://crm-uploads.teamwork.com/uploads
for general files (e.g. if adding files to a contact’s timeline) or https://crm-uploads.teamwork.com/avatar_uploads
for avatars (e.g. contact avatars). Note: if your installation is an EU installation, the URL domain should be https://crm-uploads.eu.teamworkops.com
instead.
In the body of the request provide the following fields:
name
content-type
file
The file is then processed, thumbnails are generated, and a temporary reference ID is returned in the response;
{
"tempId": "sokdfn043rj03dmw"
}
Step 2
Attach the file (or multiple) to the deal (for example) using POST files.json
giving the temporary reference ID as well as the target entity’s type and ID;
{
"files": [
{
"tempId": "...",
"isAvatar": false,
"description": "..."
},
{
"tempId": "...",
"isAvatar": true,
"description": "..."
}
],
"target": {
"id": 7,
"type": "deals"
}
}
This endpoint will return a 200 OK
when successful.
Other endpoints
This document just covers how to upload a file. Check out GET files/:id.json
and similar endpoints for getting, downloading, etc.
Feedback
If you have any feedback or suggestions, feel free to contact us at api@teamwork.com.