Skip to content
mruokojo edited this page May 20, 2012 · 7 revisions

FeelTask API

FeelTask introduces REST API which is used with json.

Authentication

Authentication is done by user persistence key, but implementation from frontend is missing yet.

Retrieving data from API

All data is available according to the following resource paths:

  • todos.json WORKING
  • /todos/ID.json WORKING

Examples

Use cUrl to load all todos: curl "http://0.0.0.0:3000/todos.json" -H "Content-Type:application/json" return example:

{"todos":[{"updated_at":"2012-03-19T16:01:07Z","completed_at":null,"notes":null, "context_id":4,"state":"active","description":"Create tasks for FeelTask","due":null,"tags":[], "created_at":"2012-03-19T16:00:59Z","recurring_todo_id":null,"project_id":null,"show_from":null,"id":47}, {"updated_at":"2012-03-19T15:37:39Z","completed_at":null, "notes":"Notes for drinks. Massive.","context_id":4,"state":"active","description":"Order drinks", "due":"2012-04-22T23:00:00Z","tags":[{"updated_at":"2012-03-19T15:37:39Z","name":"kickass", "created_at":"2012-03-19T15:37:39Z","id":31},{"updated_at":"2012-03-19T15:37:39Z", "name":"drinks","created_at":"2012-03-19T15:37:39Z","id":32}, {"updated_at":"2012-03-19T15:37:39Z","name":"funk","created_at":"2012-03-19T15:37:39Z","id":33}], "created_at":"2012-03-19T15:37:39Z","recurring_todo_id":null,"project_id":7,"show_from":null,"id":46}]}

Load todo with id 4722: curl "http://0.0.0.0:3000/todos/4722.json" -H "Content-Type:application/json" return can be like:

{"todo":{"completed_at":null,"context_id":4,"created_at":"2012-03-19T16:00:59Z", "description":"Create tasks for FeelTask","due":null,"id":47,"notes":null,"project_id":null, "recurring_todo_id":null,"show_from":null,"state":"active","updated_at":"2012-03-19T16:01:07Z","tags":[]}}

Use httparty gem to test interface loading: httparty "http://kulti.fi/tracks/todos.xml" -u feeltask:feeltask -H "Content-Type: text/xml" This call producess json list of todos, like this:

{"todos"=> [{"completed_at"=>nil, "context_id"=>5, "created_at"=>2012-04-05 19:12:50 UTC, "description"=>"Implement REST API", "due"=>2012-04-09 23:00:00 UTC, "id"=>50, "notes"=>"Mikko should do this?", "project_id"=>nil, "recurring_todo_id"=>nil, "show_from"=>nil, "state"=>"active", "updated_at"=>2012-04-05 19:12:50 UTC, "tags"=>[]}]

Writing to the API

PUT /todos/xx.json updates todo POST /todos.json inserts new.

Clone this wiki locally