Thursday, January 17, 2013

OnTime API

With the enticing prizes (new iMac! iPad! Nexus 7!), I decided to give the contest a try.

I read up OnTime API Doc, which wasn't too bad, except that they DON'T have:
  • Curl examples
  • SDK (none!)
  • Examples (except C#..)
  • Sample request for URL and body
I only need 2 API - first for authentication, then post a feature

These curl commands could help you get started quicker:

1. Get your access token

curl -X GET --data-urlencode grant_type=password  \
--data-urlencode username=yourusername \
--data-urlencode password=yourpassword \
--data-urlencode client_id=yourid \
--data-urlencode client_secret=yoursecret \
--data-urlencode "scope=read write" \
https://yourcompany.ontimenow.com/api/oauth2/token

From the JSON response, get the access token which is needed for all other APIs.


2. Post a feature (aka story)

curl -X POST \
--header "Content-Type:application/json" \
-d "{\"item\":{\"name\":\"New stuff\",\"project\":{\"id\":1}}}" \
https://hoiio.ontimenow.com/api/v1/features?access_token=youraccesstoken

Note: This assumes you have already created a project (the first is id 1).

With that, tada!~

No comments:

Post a Comment