File uploading via the API (Classic)

Please note: A newer version of this endpoint is available here.

This is a two step process. You need to first call the api with the file and you will get back a reference id. This call basically uploads the file to the site, just storing it and giving it a reference number.

The second call involves attaching that file to a project etc. So the reference id you get back in the first call you pass this in the second call. You need the response above in order to upload the file.

Your URL will look something like this:
Your first call to upload the file will be:

  • POST : https://YOURSITE/pendingfiles.json.

In the body of the request you will upload the file using the ‘file’ parameter as a form-data field.

If your call is successful you will get a ‘ref’ field in the response. That is the first part done! That repsonse looks like this:

{
    "pendingFile": {
        "ref": "tf_231A6C68-FED4-4D2F-A048A74FA5E88DD5"
    }
}

From here, you can follow this step.

Feedback

If you have any feedback or suggestions, feel free to contact us at api@teamwork.com.