Asana API for Projects Assigned to Me - api

For Tasks assigned to me, I see how I can do
curl -u <api_key>: "https://app.asana.com/api/1.0/tasks?workspace=14916&assignee=me"
I am trying to make a quick page that breaks down my current tasks and links to Asana for me, so I can have my own quick dashboard.
I have my API Key
It lists all Workspaces I am a part of.
If I click a Workspace it shows all Projects inside of that space
If I click a Project I want to see only the Tasks that have been assigned to me inside of that Project.
If I add the Project ID to that above call, it sends me back every item in the Project, not just those assigned to me.
If I leave the Project ID out, it returns all tasks assigned to me, even those outside of the project.
Did I miss something?
Thanks for any help!
Note: I would add the Asana tag, but it doesn't appear to exist yet.

It seems that in the current version of the API the assignee parameter is ignored when specified for projects. Regardless of what I put below, I get the same result: all tasks.
curl -u <api-key>: "https://app.asana.com/api/1.0/projects/<pid>/tasks?assignee=here-it-can-be-anything"

I'm having trouble with this too - it seems you can't expand projects when querying tasks - and you can't get tasks by project... The former is actually preferred since you could provide a task list by project if you could expand on project.
As it is, you can get a list of tasks, then loop through and get the full task by task-id, but that takes a while...

Related

TeamCity filter builds by tags or time period

Is it possible, through the rest API, to request all the builds with a specific tag? Along the same lines, can I get all the builds from a specific time period? For example, request the builds from 7 am to 7 pm of a specific date?
Background, I am trying to automatically pin builds based on a parameter. I had a custom script that used the rest api to pin builds and I used this script in a command line build step. The problem is, TeamCity won't allow you to pin a build that is in progress. So to get around this I am trying to do the following: I have a build step that uses a custom script to tag a build, then the idea is that I will have a script that I will run every night or so that grabs all the tagged builds, or builds from a specific time period and pin them.
Any other ideas are welcome as well.
Please do a request to:
https://{yourdomain}/app/rest/builds?locator=tag:your-tag
That's it.
From the rest API documentation: https://confluence.jetbrains.com/display/TCD10/REST+API#RESTAPI-BuildRequests
you can use the ?locator=tag:<tagName> tag to get all the builds with a specific tag name.

Script to send email notification in Teamcity

I have a requirement to send email to particular group when Teamcity's build goes green and red.
Does anyone has any idea about it ?
It is possible to configure user group and setup email notifications for this group inside TeamCity.
There are a few TeamCity plugins that you can leverage out of the box but the buildstatusnotifier
looks the most promising. You can also setup a job that gets triggerred upon completion of every build for the project you are tracking. This build will do the following:
Make a call for last status of the build project. See TeamCity REST documentation here for context. Replace "insert-base-url-here" with your teamcity base url & "btXXX" with your build id.
http://{insert-base-url-here}/app/rest/builds/buildType:(id:btXXX)/statusIcon
Save the result of this call in a DB or in a txt file
For every subsequent call, check to see if the new value is the same as the previous; if they are do not send an email. If the values do not match then proceed to step four
Send an email to the recipient/distribution list informing them of a change of status in the build status.
My personal preference will be to do all of these in an nant script but those are the steps to take.
You can also look at the Build-status tool (build-status.appspot.com) which can be setup and displayed in a highly visible place that your team will not miss should it turn red.

How does one list the changes via the API from a TeamCity build?

I'm trying to find a way to get all the comments from a particular build in TeamCity via the Rest API. How can one do that?
http://teamcity:port/httpAuth/app/rest/changes?locator=build:(id:77651)&fields=count,change:(version,username,date,href,comment,files)
Via this URL, one can list out in custom fashion exactly the fields they wish to return. I don't think this is documented, i got this from their support folks. Enjoy!
PS - There are other examples out there which iterate over each change, this lists out all the changes for a particular build id in one place, for parsing.

asana tasks api does not work for GET /tasks GET /workspaces/workspace_id/tasks but for GET /projects/project_id

My query were these:
https://app.asana.com/api/1.0/tasks
But I have this error instead: "Must specify exactly one of project, tag, or workspace"
When I try out for the workspace with this:
https://app.asana.com/api/1.0/workspaces/workspace_id/tasks
I have this error: "assignee: Missing input"
However, I will get a list of tasks if i use the projects instead...
Please advice.
(I work at Asana)
You must always filter a task query with something, as we do not yet support pagination and all tasks in a workspaces will usually be a huge volume of data. Specifying a project implicitly scopes the query to a workspace, as every project exists in exactly one workspace. You can specify assignee, but then you must additionally filter by workspace.
So your choices for filtering tasks are either by project or by BOTH assignee and workspace.

Getting all Asana-Tasks (not just the non-archived ones)

When I request my Workspace with the Asana-Api, like this:
curl -u <api_key>: "https://app.asana.com/api/1.0/tasks?workspace=14916&assignee=me"
Im not getting just the non-archived ones like written in the Documentation.
(https://asana.com/developers/api-reference/tasks in the section: QUERYING FOR TASKS)
Im wondering if I do something wrong, or if just the API sends me a wrong result.
Does anyone has the same problem?
According to Ryan from the Asana team (Thanks for the Email support), its just the fact, that you have to archive the tasks in the right view. I archived it always in the Project-View but this seems not to be the same as in the "My Tasks View". The API request like described above looks the state of the Tasks in the "My Tasks View" up.
Ryans Answer:
It's worth noting here how archiving works in Asana. Archiving is per
view/project. If I have a completed task assigned to me in Project A
and I archive the completed tasks in my My Tasks list, that action
will not archive it in Project A.