Postman is an application (Desktop or Web) that can be used to access the Asana API (as well as many others). There is a whole language around APIs that can get pretty confusing so follow this step-by-step guide below to get at your Asana data with the minimum of fuss.
This process covers use of the Web Application which is almost identical to the Desktop Application. So let’s get on with Using Postman to access your Asana data!
Sign up for a Postman account
Go to https://www.postman.com/ and sign up.
On clicking “Create Account”, I filled in a brief form supplying some additional information for my account.
The next step, “Collaborate with teams” can be skipped. Click “Continue without a team”.
This should bring you to a welcome screen.
If you signed up via email, you will probably have received a confirmation email by now. Be sure to confirm your email.
Set Up Postman
On the left hand side of the screen above, you will see a link labelled “Workspaces”. Click on that link and select “New workspace”.
Your new workspace name should reflect what you are currently working on. Under visibility, select “Personal” from the drop down and then click on “Create Workspace”.
You will now be brought to the your newly created workspace. To organise our workspace, we first need to create a collection. Keep in mind that we are using postman in a very simple way, so we do not need to worry too much about how we organise our work.
In this case, I called my collection “Basic Asana Reporting”.
Retrieving data from Asana’s API
To get started with talking to the Asana API. Click on the “Add a request” link (Look at the text underneath the area highlighted in red on the previous image).
Postman usually requires some technical understanding of APIs – I am assuming that the reader is here because they do not have this technical knowledge so, for your own sake, it is probably best to just follow the steps without worrying too much about understanding all the terminology.
By default, all new requests in Postman are “GET” requests, leave that as is.
To get started, we are going to request a full list of all the current projects in Asana for our organisation.
We need to get two things prior to submitting requests to Asana’s API.
- A Personal Access Token
- Your Asana Workspace ID
Personal Access Token or PAT
Using Postman to access your Asana data requires an Asana generated PAT.
Within the Asana Webapp, go to “My Profile Settings” accessable by clicking on your profile picture at the top right of the app.
Click on the Apps tab and select “Manage Developer Apps”
Click on “+ New Access Token”
Give the token a name and agree to the Ts & Cs.
Click Create Token. A token looks like a long string of random characters roughly 50 characters in length.
Note – You should never share the token with anyone. Keep it safe.
Copy the token and go back to Postman. Select the “Authorization” tab and select “Bearer token” from the drop down.
Paste your token into the field provided.
Your Asana WorkSpace ID
Visit https://app.asana.com/api/1.0/workspaces in the same browser where you are logged into to Asana. You should see a long string listing all of the workspaces you have access to. Each workspace will have a long number called a “gid” associated with it. Grab the gid for the workspace you are interested in. It should look like a long number about 13 digits in length.
Finally – Retrieving data from Asana with Postman
At last, in Postman, paste the following URL into the GET field. (Replace the text <<ENTER YOUR gid HERE>> with your actual gid obtained in the last step).
https://app.asana.com/api/1.0/projects?workspace=<<ENTER YOUR gid HERE>>&limit=100&archived=0&opt_fields=created_at,owner.name,public,name,archived,is_template
You will notice when you do this that Postman automatically creates some Param fields.
Click the large blue “Send” button on the right hand side of the Postman screen. After a few seconds you should see a response. Hopefully not an error message. You want the Status of the response to be “200” and a large JSON string to appear in the lower portion of your screen. (JSON is simply a way of formatting data, note the curly crackets, quotes and colons).
More than 100 projects in your Asana Workspace? In that case, you need to deal with “Pagination”. To limit the workload on their API, Asana allows you to access only 100 records at a time. (Hence the parameter “limit” above).
To see the remaining projects, grab the full JSON from Postman and copy it into a text editor such as Notepad.
Copy the extremely long string labeled “offset”. You need everything inside the double quotes. This needs to be added as a new parameter in Postman. Under the Params tab, add a new Key / Value.
The key should be set to “offset” and the value should be the very large string copied from the first JSON. Once entered click “Send” once more.
Note: If you take too long, you may receive an error “offset: Your pagination token has expired.” In this case, untick the checkbox beside the offset Key and re-Send. This will give you the first 100 projects again with a new offset string at the bottom. Re-tick the checkbox beside offset, copy the new offset keyinto the Value field opposite the offset key. Click Send.
That’s it – You may have to repeat this last step if you have greater than 200 projects. Eventually your JSON will not have an offset value for you to copy.