Example requests - code sample feature

The example request feature will allow you to generate useful code samples in a few simple steps.

You will have the ability to dynamically alter the site name in the endpoint URL and add your own API credentials which will be added to the code sample and ready for copying and pasting into your script of choice.

Start by clicking on Expand request settings

Here you will find a form to add your Site Name and Authentication credentials.

Add your site name and this will be applied to the URL in the code sample. If you have a custom domain, type that in instead and teamwork.com will be removed.

For Teamwork.com, Basic auth is default. If you are using a token supplied from the app login flow, please skip to Bearer Auth below.

Username Field:

Add your email address or a valid API Key in the user field. 

Password Field:

Note: If you are using your email address make sure that you add your password used to log into Teamwork.com into the password field.

If you used an API key in the user field you can add anything into the password field, even ‘xxx’

If you have a token after following the steps in the app login flow you can use the dropdown to change from Basic to Bearer.

Add your token in the field.

The code sample will include a base64 encoded version of your authentication credentials when Basic auth is selected. Click on copy and paste the code into your script of choice.

Code sample Languages:

Today we support Shell, JavaScript and Go. We are reviewing other languages which will be available soon. If there is a specific language you would like to see supported please let us know at api@teamwork.com.

Caveats:

  • Get requests without additional path variables can be copied and used straight away. 

    • All other requests can be copied, however users must apply path variables manually in their own code.

  • Query params are not dynamic yet, but this is being reviewed for a later update