Within the
Teamwork.com API, you can leverage the official Teamwork.com Postman collections to make requests via the Postman
API client.
Once
Postman is installed, collections are
imported, and environments are
configured, calls can
be made to GET, PUT, POST, PATCH
and DELETE from
Teamwork.com.
Official
Teamwork.com Postman
collections
The different Teamwork.com collections can be downloaded below before being imported to your Postman account.
If you are already
familiar with Postman
and the setup requirements, you can
download the
collections and start
experimenting with the
API.
Step 1: Installing
Postman
Download the
client
application here and
install
it.
Step 2: Importing the Teamwork.com
collections
Download the
required official Teamwork.com collections
linked above and
save them to a known
location.
To import the
collections, log in to your Postman
account. While viewing your workspace,
select
the Collections tab
from the left navigation menu and
click
the Import button at
the top of the workspace Collections pane.
In the Import modal,
select the File tab
and click
the Upload
Files button.
Use the file browser to locate and select the
downloaded official Teamwork.com collection
file(s). Click
the Import button to import
the file(s) to Postman.
Once imported, you can access the
Teamwork.com collections via
the Collections tab of your
Postman workspace.
Step 3: Creating an environment and
setting variables
Postman
utilizes environments and variables to
make it easy to
quickly change the
target of a request.
After creating a new
environment, variables
must also be created
to hold specific
values used by the
Teamwork.com (version number)
collection.
Click
the eye icon in the top right of
your workspace and select
the Add option in
the Environment section of the
dropdown.
You will need to set an environment
name and fill our the relevant
variable details that will be used for
each request.
- Domain -
should match the domain of
the
URL when logged in to your
Teamwork.com site
- E.g. https://yoursite.teamwork.com.
- Note: If the
tenant uses a
vanity domain, it must be
used
here.
- Path - for V2 and V3 of the Teamwork.com API, the paths should be set as:
- Version 2: "/projects/api/v2"
- Version 3: "/projects/api/v3"
- Note: There is no path for V1 of the Teamwork.com API.
- Basic
Authorization -
the appropriate header
sent along with each request
in the collection provides the
necessary security to properly
identify the consumer and
allow the request.
Therefore:
- Username variable
must be set to the
associated username of the
user account
configured in your
Teamwork.com
site.
- Password variable
must be set to the user
account password used to
log
in to your Teamwork.com
site.
Once you have filled out the
relevant variable details, click
the Save button at
the top of the view to save the
environment.
The new
environment will be accessible via
the Environments dropdown.
Setting up authorization at
collection
level will allow for all subsequent
folders to inherit the chosen
authentication method.
Step 4: Sending requests
The following
screenshot shows a
numbered sequence of
required steps for
sending a
request:
Open the Environments dropdown in
the top right of your workspace and
select an environment to be used as
the target of the request.
Note: This will remain
the selected
environment across all
requests unless a new
environment is
selected.
Expand the relevant Teamwork.com API
version from the left navigation pane
under Collections and select
the relevant request to be used.
The request type (GET in this
case) and request
query string will populate.
- The
query string will contain the entity to be
queried along with
any optional parameters.
- The Domain and Path variables
in the query string are color
coded.
- If all the variables
are colored orange,
they are set correctly and
the request can be
made.
- If any of the variables
are colored red,
they are not set correctly, do
not exist, or no environment
is selected and the request
will fail.
Click
the Send button at the top of
the request view to execute the query.
Once a response is
returned from the API, it will contain the
status code, time, and JSON
data.
For more information, see: Postman API
Client