Introducing the Goals API

Hello all! Our team is committed to deliver a feature-rich API, and today we’re excited to announce new API endpoints available for Goals!

With Goals, you can drive alignment across your company by consolidating goals and tying them directly to your teams’ work. We’re introducing this functionality in the API, so you can now build custom integrations to programmatically:

  • Get a holistic view of your organization’s goals in a single place
  • Automate large amounts of work and progress updates
  • Make changes to goals in your tools of choice

Now, on to the good stuff! Here’s what we’ve added:

Head over to our docs to see how it all works!

As always, feel free to leave comments and questions here. Be sure to check back for more updates and announcements as well as we continue to add new features to the API. Happy goal-achieving! :rocket:

11 Likes

Great news, already using that API! Keep it coming :heart:

4 Likes

A quick update today: we’ve exposed endpoints for Time Periods and for creating a Goal through the API. The table in the original post has been updated as well. Happy Friday, everyone!

5 Likes

Is it working now? I´m trying to use all the methods associate with goals and i´ve been receiving this:

“Client’ object has no attribute 'goals”. Shoud I use a different endpoint? I´m trying to do this request with Python using the examples on Asana API page.

Thanks

Hi @AndrewWong

I have a question, I try to access the goals (https://app.asana.com/api/1.0/goals) but I get this error message:

{“errors”:[{“message”:“You should specify one of portfolio, project, workspace, team”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: Build an app with Asana”}]}

I have the workspace ID however I don’t know how to add in the URL, could you please help me?

Thank you very much!

M.

Hi @M_Àngels_Jover,

Here is the syntax for that:

https://app.asana.com/api/1.0/goals?workspace=111403789277882

cc: @AndrewWong
Andrew, the example for this endpoint in the API docs isn’t right; it doesn’t show the use of a qualifier like workspace, portfolio, etc. so IMO it makes sense that users like this would be confused.

Hey @anon11662647 ,
In case you’re still looking for a solution, I have one for you:
You need to connect the goals resource to the asana client object:

Once done, you should be able to use all the functions described in:

Good luck :slight_smile:

1 Like

Thanks! I collect the latest version on the GitHub and installed it. Now It´s been available to me!

Hi @M_Àngels_Jover , Can you help me for the Goals api? How can I find workspace ID? I don’t find any option for that in asana

@Phil_Seeman @Bastien_Siebman
Hi guys! I really need you help.
I am working on a big project that involves collecting all the gaols that are stored in Asana and showing them in a Tableau dashboard. I can connect, get users, get gaols, etc…no problem.

My problem is trying to get a subgoals and parent goals - I keep getting errors and I cannot use the response coming from the API.

So, as an example I am using it is way. Where the parent goal_gid is from the url of the parent goal in Asana.

result = client.goals.get_subgoals_for_goal(1201900678911488, opt_pretty=True)

Result then shows <generator object PageIterator.items at 0x7f706aeaac00>

However, when I keep trying to get at the data I keep running into the error of TypeError: ‘int’ object is not iterable

The end goal is to get this into a Pandas dataframe so I can do more things to the data!

Please help!

that’s the method from the client you are using? the “not utterable” error makes me think there is an issue around iteration/pagination, maybe get subgoals gives you a collection and not an array. Does this help debug? :sweat_smile:

Yeah it looks like a bug in the Asana client to me. I would try it in Postman; if it works there, then that pretty much says it’s a client bug and you should report it to api-support at asana dot com.

1 Like

Unless you are giving the wrong parameters, like an id as a number instead of a string.

hello.
I’m using this API and I get the following error:

self.client.goals.get_subgoals_for_goal (goal_gid = '1202357121126643', limit = 100)
'Invalid Request: parent: Not a Long: {goal_gid}'

Please give me some advice.

Taiki - this connector does not work for the subgoals. you need to bypass the client provided use requests to get the data.

create loop for cycling though the list of Sub Goal Gids
for index, row in Goal_details_all_df.iterrows():
request_string = “https://app.asana.com/api/1.0/goals/” + row[‘gid’] + “/subgoals?opt_pretty=true&opt_fields=followers,assignee”
response = requests.get(request_string, headers={‘Authorization’: Token_string})
response_text = response.json()
df = pd.read_json(json.dumps(response_text))
df[‘Parent_sub_goal_gid’] = row[‘gid’]
Sub_Goal_details_all_df2 = Sub_Goal_details_all_df2.append(df)

1 Like

My application has a similar visual as the goals page (list of goals and their subgoals with all the information)
I don’t understand how I can get all this through the api, as I only get the “gid” “resourse_type” fields most of the time. In your dashboard you probably have SSR and I couldn’t see which api you call

@anon93471150 you need to use the param opt_fields to ask for specific fields, they don’t all come in by default.

by default, GET /goals returns a list without specifying whether it is a goal or a subgoal. (perhaps in opt_fields, but the documentation doesn’t mention it) I don’t understand how you can get a list of main targets and subgoals nested within them. Similar structure as in the dashboard on the “Goals” page

The parent goal is a potential field you can ask for using the opt_fields. The presence or absence of a parent goal will allow you to determine if this is a goal or a subgoal.