Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Pivotal Tracker API – new version (V3) to be released on Jan. 23

Dan Podsedly
Sunday, January 17, 2010

We’re planning a Pivotal Tracker upgrade on Jan 23. As part of this release, we will be introducing a new API version (V3), which will make it easier to follow project activity, allow you to add file attachments, move (re-prioritize) stories, associate source commits with stories, and more.

The current API version (V2) will not change, but V1 will no longer work. If you’re still using V1, you will need to change your client code to use V2 or V3.

To find out what’s changing in V3, continue reading.

How to tell what version of the API you’re using?

The API version identifier is part of the request URLs. For example, this is a V2 request:


http://www.pivotaltracker.com/services/v2/projects

What’s New or Changed in V3

Activity

The response for the activity queries will change significantly. It will include a version # (to allow you to keep track of unique events and their order), event type, when the activity occurred (with time zone), and a nested element with all story attributes that changed as part of the activity. Example:

<activities type="array">
  <activity>
    <id type="integer">1031</id>
    <version type="integer">175</version>
    <event_type>story_update</event_type>
    <occurred_at type="datetime">2009/12/14 14:12:09 PST</occurred_at>
    <author>James Kirk</author>
    <project_id type="integer">26</project_id>
    <description>James Kirk accepted &quot;More power to shields&quot;</description>
    <stories>
      <story>
        <id type="integer">109</id>
        <url>https://www.pivotaltracker.com/services/v3/projects/26/stories/109</url>
        <accepted_at type="datetime">2009/12/14 22:12:09 UTC</accepted_at>
        <current_state>accepted</current_state>
      </story>
    </stories>
  </activity>
</activities>

You’ll also be able to query for all activity since a particular date or version #, and you limit how many entries to return (up to 100):

curl -H "X-TrackerToken: TOKEN" -X GET http://www.pivotaltracker.com/services/v3/activities?newer_than_version=13
curl -H "X-TrackerToken: TOKEN" -X GET http://www.pivotaltracker.com/services/v3/activities?occurred_since_date=2009/12/14&limit=50

Activity Web Hook

This will allow you to specify a URL per project (in project settings), which Tracker will post story activity to, in the same XML format as above. You’ll be able to “pull” story activity out of Tracker via normal API GET requests, or have it POSTed to your client as it occurs via the activity web hook.

Projects

The project XML response will include the current and initial velocity, last activity date, and a list of all labels in the project.

Example:

<project>
  <id>1</id>
  <name>Sample Project</name>
  <iteration_length type="integer">2</iteration_length>
  <week_start_day>Monday</week_start_day>
  <point_scale>0,1,2,3</point_scale>
  <account>James Kirks Account</account>
  <velocity_scheme>Average of 4 iterations</velocity_scheme>
  <initial_velocity>10</initial_velocity>
  <last_activity_at type="datetime">2010/01/16 17:39:10 CST</last_activity_at>
  <number_of_done_iterations_to_show>12</number_of_done_iterations_to_show>
  <labels>shields,transporter</labels>
  <allow_attachments>true</allow_attachments>
  <public>false</public>
  <use_https>true</use_https>
  <bugs_and_chores_are_estimatable>false</bugs_and_chores_are_estimatable>
  <commit_mode>false</commit_mode>
  <memberships>
    <membership>
      <id>1006</id>
      <person>
        <email>kirkybaby@earth.ufp</email>
        <name>James T. Kirk</name>
        <initials>JTK</initials>
      </person>
      <role>Owner</role>
    </membership>
  </memberships>
</project>

When creating a project via the API, the user represented by the API token will be made an owner of that project by default. To leave the new project without an owner (because your client is acting on behalf of a different user, for example), you’ll need to include <no_owner type="boolean">true</no_owner> in the post data.

Stories

You’ll be able to move (re-prioritize) stories via the API. To move a story to after another story:

curl -H "X-TrackerToken: TOKEN"
    -X POST http://www.pivotaltracker.com/services/v3/projects/PROJECT_ID/stories/STORY_ID/moves?move[move]=after&move[target]=TARGET_STORY_ID"

Or, move it before a story:

curl -H "X-TrackerToken: TOKEN"
    -X POST http://www.pivotaltracker.com/services/v3/projects/PROJECT_ID/stories/STORY_ID/moves?move[move]=before&move[target]=TARGET_STORY_ID

As part of the new integrations feature (watch for more on that later), you’ll be able to associate a story with a ticket or issue in an external system, such as Lighthouse or JIRA. You’ll need to specify a ticket/issue ID, and optionally which specific integration to use (a project may be set up with multiple):

curl -H "X-TrackerToken: TOKEN" -H "Content-type: application/xml"
    -d "<story><lighthouse_id>54</lighthouse_id></story>"
    -X PUT http://www.pivotaltracker.com/services/v3/projects/PROJECT_ID/stories/STORY_ID"

Stories that are linked to a ticket or issue in an external system (for example JIRA or Lighthouse) will include the external ID as an attribute, as well as the URL to the linked ticket/issue:

<story>
  <id type="integer">STORY_ID</id>
  <story_type>feature</story_type>
  <url>http://www.pivotaltracker.com/story/show/STORY_ID</url>
  <estimate type="integer">1</estimate>
  <current_state>unstarted</current_state>
  <lighthouse_id>43</lighthouse_id>
  <lighthouse_url>http://mylighthouseapp.com/projects/100/tickets/43</lighthouse_url>
  <name>More power to shields</name>
  <requested_by>James Kirk</requested_by>
  <created_at type="datetime">2008/12/10 00:00:00 UTC</created_at>
</story>

File attachments

Here’s how you’ll be able to upload a file attachment to a story:

curl -H "X-TrackerToken: TOKEN" -X POST -F Filedata=@/path/to/file http://www.pivotaltracker.com/services/v3/projects/PROJECT_ID/stories/STORY_ID/attachments

The story response will include information about file attachments in this nested XML element:

<attachments type="array">
  <attachment>
    <id type="integer">17</id>
    <filename>Picture_36.png</filename>
    <description></description>
    <uploaded_by>Rob</uploaded_by>
    <uploaded_at type="datetime">2010/01/17 14:57:57 CST</uploaded_at>
  </attachment>
</attachments>

Note: Attachments in the story response XML will most likely not include a URL to the actual AWS S3 file, since these URLs are only valid temporarily. You’ll need to make a separate API call (details TBD) to get the S3 URL for a given story file attachment.

Source Control Post Commit Hooks

This will allow you to set up post-commit hooks in git, github, subversion, etc., to link commits to stories (and optionally mark them as finished) based on this message syntax:

“Torpedoes now sufficiently powered [fixes #123456]“.

Curl example, of what you might do in a custom post-commit hook script for subversion or git:

curl -H "X-TrackerToken: TOKEN" -H "Content-type: application/xml"
    -d "<source_commit><message>$MESSAGE</message><author>$AUTHOR</author><commit_id>$REV</commit_id><url>http://trac.yourcompany.com/browser/?rev=$REV</url></source_commit>"
    -X POST http://www.pivotaltracker.com/services/v3/source_commits

Stories will show associated source commits as comments, with a link to the commit if you include a URL in the post body:

Commit comment

Github Support

The V3 version of the API will also support native Github post-commit hooks, allowing you to configure your Github repo to send commit information directly to Tracker, along with the [fixes #12345] message syntax.

The format of the Github post-commit request will be:


https://www.pivotaltracker.com/services/v3/github_commits?token=API_TOKEN_OF_THE_USER_TO_ATTRIBUTE_ACTIONS_TO

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

13 Comments

  1. Kyle Daigle says:

    Very cool guys, looking forward to upgrading to the new API and using it in our tracker dashboards we built.

    January 17, 2010 at 3:00 pm

  2. Steven Yan says:

    Awesome Dan! We’ll look into upholding our end of the bargain. Love the github hooks too.

    January 18, 2010 at 5:23 pm

  3. Chris Bailey says:

    Great work continuing to expand the API! I wanted to mention my GitHub post-commit hook in light of the new support. I was hoping that yours would wind up replacing mine, but there’s one key difference as far as I can tell. With the Github support in the API, all commits will wind up getting attributed to a single Tracker user. This is how mine worked originally, but on a multi-person team it sucks, because it looks like all commits are coming from one developer and you don’t have any context about which developer made that commit if you have questions, etc.

    Another thing is that mine also supports changing the state of the story (say to “finished”) as part of your commit message. We’ve found this to be really nice, as your Story gets automatically set to Finished as soon as your code is in the master branch for example.

    Anyway, so if folks want a post-receive hook that you can correlate commits to Tracker users, you can try my tiny little Sinatra app that’ll do it. Commit syntax is similar, by using “[Story12345]“. To change state, use “[Story12345 state:finished]” (for example).

    You can get it here: http://github.com/chris/tracker_github_hook

    January 19, 2010 at 12:09 am

  4. Dan Podsedly says:

    Hey Chris…thanks for sharing that. The built in post-commit hook will actually allow you to set stories as finished based on the [finishes #123456] syntax. It won’t support arbitrary states, though. We may also try and tie the commit author to a project member, if we have time before the weekend.

    thanks
    dan

    January 19, 2010 at 8:13 am

  5. Chris Bailey says:

    Dan, that’s great, good to know. As for tieing to a project member, that’d be excellent of course. The one thing we’ve found tricky with that is that the emails don’t always match up (e.g. my GitHub email is different than my Tracker email). Probably a more rare case of course. Maybe Tracker itself could have alternate email addresses for a given member (I’m mentioning this as I’m sort of presuming this is how you’d do the matching, given only a single API token).

    January 19, 2010 at 8:47 am

  6. Dan Podsedly says:

    For the first pass, we’ll probably just try and find a project member with the same username/email as the commit author, and if we don’t find one, just use the token user.

    January 19, 2010 at 3:49 pm

  7. joel meador says:

    Awesome!
    Been waiting for the move API for along time.

    Are the two move examples revesered?

    January 21, 2010 at 12:10 pm

  8. Dan Podsedly says:

    They were reversed, thanks for catching that. Fixed now.

    January 22, 2010 at 10:44 am

  9. Steven says:

    Interesting. It will take some time to upgrade to the new API, but I’m definitely going to do that.

    January 26, 2010 at 8:25 am

  10. hani elabed says:

    Hi Dan,
    I am updating our ruby-pivotal-tracker from v1 to v3.

    http://github.com/bendycode/ruby-pivotal-tracker

    While I can look at the v2 and v3 APIs online, I don’t see the v1 API. Is it possible to share with me the responses to all v1 API calls( one time only – no need to put it online – just email it to me if it is not too much trouble )?

    Othwerwise I will have to reverse engineering the ruby code and deduce what the XML resposnes are. It would be way easier to look at what the actual responses were for the v1 of the API. As you currrently show them here for the v2 and v3 APIs.
    http://www.pivotaltracker.com/help/api?version=v2
    http://www.pivotaltracker.com/help/api?version=v3

    Thanks in advance

    hani elabed

    February 8, 2010 at 10:46 am

  11. Sergio says:

    just curious about the overall architecture. Do you use the exposed HTTP API also from your Web presentation layer or the API is meant only for external apps while you access the back-end functions using a different library?

    April 1, 2010 at 8:45 am

  12. mark gibson says:

    Love pivotal tracker, and i love the gui. I was wondering if the source was available – in particular the javascript that does the layout/adding/removing of the panels (current/backlog…)
    thanks – mark

    March 28, 2013 at 12:46 pm

    • Dan Podsedly
      Dan Podsedly says:

      Mark, glad to hear you’re a fan of Tracker and the UI. Unfortunately none of the source is open, but we are considering open sourcing at least some of the underlying frameworks. We’ll also be posting some technical info about how we rewrote it using Backbone later this year, so keep an eye on the blog and/or twitter.

      March 28, 2013 at 1:59 pm

Add New Comment Cancel reply

Your email address will not be published.

Dan Podsedly

Dan Podsedly

Dan Podsedly manages Pivotal Tracker, Pivotal Labs’ award winning project management and collaboration software.

Dan has been building large applications since the Smalltalk era, and has been a practitioner and coach of agile programming methods since the earliest days of Extreme Programming. He has led projects in a variety of industries, built a consulting practice from the ground up, and was instrumental in the successful adoption of agile methods at some of the world's largest e-commerce companies.

Dan joined Pivotal in 2004 as Principal, and spent the next four years leading Pivotal’s largest client engagements. In 2008, Dan led the public launch of Pivotal Tracker, originally developed as an internal tool to help Pivotal developers improve their efficiency, and has grown the product into what it is today - a popular, well known force of agile transformation in the software industry used by hundreds of thousands of developers.

Dan's Blog

Recent Posts

  • Monday’s Tracker Outage, New Status Page
  • Browser support in Pivotal Tracker
  • 2013 Tracker Update – New Features, New API, New Design
Subscribe to Dan's Feed

Author Topics

agile (39)
api (4)
productivity (13)
ios (2)
ipad (3)
iphone (1)
meetup (8)
google apps (2)
lean startup (1)
open source (1)
jobs (1)
rails (5)
scrum (1)
nyc (4)
gtd (1)
beer (3)
selenium (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >