15

I want to add Asana to my intellij IDE.

Right now I am using the web client, however it would be easier to work directly through the IDE.

I read the intellij help pages and they directed me to go to settings - tasks and fill in the details. However, when i fill in the details, and click "test"

enter image description here

It says the test failed - unauthorized. I tried looking for help on the Asana blog, but found nothing.

What am I missing ?

Lena Bru
  • 13,521
  • 11
  • 61
  • 126
  • Huh! I'm one of the few Asana engineers who doesn't use IntelliJ, but I'll ask around and see what other people do. – agnoster Jul 25 '14 at 16:01

7 Answers7

12

Everything you need in March 2020 is:

  1. Go to "My Profile Settings" -> "Apps" -> "Manage Developer Apps" enter image description here
  2. Click "New access token" and create a new token. Give it a name, like "Task Server" and note it down (it's shown only once!) enter image description here enter image description here enter image description here
  3. Done for now in Asana. Open the IDE and open "Preferences" -> "Tools" -> "Tasks". Increase the connection timeout: enter image description here
  4. Go to the "Preferences" -> "Tools" -> "Tasks" -> "Servers" and add new "Asana [G]" server. Open the "Server configuration" tab and click "Manage Template Variables". Add a workspace variable. Check "Show on first tab" for convenience: enter image description here
  5. Click "Ok" and change "Tasks List URL" to {serverUrl}/tasks?workspace={workspace}&assignee=me: enter image description here
  6. Change id and singleTask-id properties in "Server Configuration" to gid and data.gid: enter image description here
  7. Finally, go to the "General" tab and fill in the details. enter image description here

Username is your access token. Project ID and Workspace can be taken from URL of project's home and workspace's home. Read more about the REST API in the docs.

madhead
  • 31,729
  • 16
  • 153
  • 201
  • 4
    This is pretty great and works well! One thing of note that I got hung up on for a while, the API does not support filtering by both assignee and project, so if you want to only retrieve tasks from a particular project you'll have to replace the "Task List URL:" with `{serverUrl}/projects/{project_ID}/tasks`. – Mat Lipe May 29 '20 at 21:02
  • 1
    Getting a 404 Not Found – Lindeberg Aug 12 '21 at 14:59
  • See Mat Lipe's comment above for 404 issues. – Aaron Greenlee Apr 21 '23 at 14:14
11

What are you putting in "Username" and "Password"? It should require your API key (which you can find from "Account Settings" in the lower left > "Apps" tab > "API Key" link at bottom) as the username and no password (the API key fulfills the purpose of identifying and authorizing you).

agnoster
  • 3,744
  • 2
  • 21
  • 29
  • None of the help documentation does not say that! As soon as i did what you said, it worked ;) Thank you! – Lena Bru Jul 25 '14 at 16:18
  • Glad that helped! Can you include a link to the documentation you were looking at? It might be possible to send a pull request (or even just a tweet or email) to get that updated so other people don't fall into the same trap :-) – agnoster Jul 25 '14 at 17:19
  • This is what i was reading: http://www.jetbrains.com/webstorm/webhelp/enabling-integration-with-an-issue-tracking-system.html The confusing part was that it is asking for "username". Had it stated "API Key" instead of the word username field, i would have known to paste it there myself. Because I read the Asana documentation, and that said i needed an API key to send a CURL request. And I found the API Key, but didn't know what to do with it, in Intellij. So the change imo should be -> remove password field, and rename "username" to "API Key", which will make it self explanatory. – Lena Bru Jul 25 '14 at 17:56
  • Also, I would suggest, on the asana side, add to your documentation how to integrate with different IDE's, it is very easy to use it, after i set it up – Lena Bru Jul 25 '14 at 17:57
  • 1
    I am following the exact same steps as you suggest @agnoster, however, I keep getting the an error "Request failed with HTTP error:NOt Found" . I have a screenshot as well, attaching in a separate answer as I dont think comments allow pictures – dowjones123 Nov 28 '14 at 13:56
  • This method has been deprecated. – Kevin Beal Oct 19 '17 at 17:34
6

TLDR; You're probably missing the Project ID field (if you're already putting your api key in for the username)

I ran into the Request Failed: Not Found error as well. According to the asana api (when I tried the request via curl) to list tasks you:

"Must specify exactly one of project, tag, or assignee + workspace"

The intellij task / asana integration is set up to list tasks from a project. You need to fill in the Project ID field in the intellij IDE Task Server Configuration > General. You may need to query the api to get your project id:

curl -u <api_key>: https://app.asana.com/api/1.0/projects

Adding the Project ID to your settings should fix the task requests.


Pro Tip ™

Personally I want to list all tasks assigned to me across all projects. You can customize the intellij task server settings to ask for all tasks in a workspace. To do this go to the "Sever Configuration" Tab on the intellij Task Server Configuration, click on manage "Manage Template Variables..." button and a variable for workspace_ID and provide your workspace id. You can get your workspace IDs here:

curl -u <api_key>: https://app.asana.com/api/1.0/workspaces

You also need to change the Task List URL in the settings to:

{serverUrl}/tasks?workspace={workspace_ID}&assignee=me
Max
  • 104
  • 1
  • 1
  • Regarding the Project Id. When I open Asana on the relevant project, the url contain your project id: https://app.asana.com/0/[Project_ID]/list – chenop Aug 29 '15 at 07:33
3

Update August 2018 (at least, if you're using Asana's workspaces):

  1. Under Server Configuration, click the button to Manage Template Variables.

  2. Add a new template variable named workspace_ID, and check the box to show on first tab (ignore the serverURL value I've put in here, I was messing around):Template Variables

    1. For the value of workspace_ID, get the number from a cURL request (substituting your own API key):

      curl -u '0/987654321fedcba': https://app.asana.com/api/1.0/workspaces

    2. Save the changes.

    3. There's been a change to Asana's API : you can specify [assignee + workspace] or you can specify [project]; you can't specify [ project + assignee ].

    4. Still in Server Configuration, change the Tasks List URL to one of the following (depending on what you want) :

      {serverUrl}/projects/{project_ID}/tasks
      

      or

      {serverUrl}/workspaces/{workspace_ID}/tasks?assignee=me
      
    5. Press the Test button and you should be OK.

cobberboy
  • 5,598
  • 2
  • 25
  • 22
  • 1
    NOTE: As of IntelliJ 2019.3, if you are using the workspaces URL, you need to uncheck the project_ID under "Show on first tab". If you don't do this, IntelliJ will think the form is incomplete and not load your tasks (even though the connection test passes). – Hudon Feb 25 '20 at 18:21
  • 1
    Thanks @Hudon. In 'Server Configuration', I also had to replace all occurrences of `id` with `gid` (i.e. `{id: "gid", "singleTask-id": "data.gid"`} ). – cobberboy Feb 26 '20 at 00:58
1

I am following the exact same steps as you suggest @agnoster, however, I keep getting the an error "Request failed with HTTP error:NOt Found" . I have a screenshot as well, as attached

enter image description here

dowjones123
  • 3,695
  • 5
  • 40
  • 83
1

API Keys are deprecated in favour of OAuth 2.0. See here: https://asana.com/developers/documentation/getting-started/auth#api-key

Tobias Etter
  • 744
  • 1
  • 6
  • 19
0

You should use your Api key as username, leave password empty and check "Use HTTP Authentication"

krun
  • 790
  • 1
  • 5
  • 7