Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

API

badboy edited this page · 2 revisions
Clone this wiki locally

Authentication

GET https://teuxdeux.com/api/user.json

This request takes no params but the auth information using Basic Auth.

You can check for valid auth info with this. Each request needs this basic auth info!

Header:

  • Authorization: base64(mail:password) (Basic auth)

Response: 200 OK on success, 401 Unauthorized on failure.

  • Set-Cookie: _barebones_session=<id> (unknown if it is needed, but I think it's not)

Body:

{
  "id": <user id>,
  "login": <user name>,
  "email": <user mail>,
  "time_zone": <timezone name>, # e.g. "Berlin"
  "utc_offset": <timezone offset in minutes>
}

Listing

GET https://teuxdeux.com/api/list.json

Params:

  • since: YYYY-MM-DD date string (optional)

Response: 200 OK

Body:

[
  {
    "id": <todo id>,
    "updated_at": <timestamp>,
    "position": <position, 0 by default>,
    "do_on": <YYYY-MM-DD date>,
    "user_id": <user id>,
    "todo": <todo string>,
    "done": <boolean>
  },
  { ... },
  ...
]

GET https://teuxdeux.com/api/list/someday.json

Response: 200 OK

Body:

[
  {
    "id": <todo id>,
    "updated_at": <timestamp>,
    "position": <position, 0 by default>,
    "do_on": <1989-12-DD, DD specifies column in someday, 01 being left>,
    "user_id": <user id>,
    "todo": <todo string>,
    "done": <boolean>
  },
  { ... },
  ...
]

Creating ToDos

POST https://teuxdeux.com/api/todo.json

Params:

  • todo_item[todo]: String
  • todo_item[do_on]: String, format: YYYY-MM-DD
  • todo_item[done]: Integer, 1 or 0 (boolean)
  • todo_item[position]: Integer, default: 0 should work on creation

Response: 200 OK

Body:

{
  "id": <todo id>,
  "updated_at": <timestamp>,
  "position": <integer>,
  "do_on": <YYYY-MM-DD date string>, 
  "user_id": <user id, integer>,
  "todo": <string>,
  "done": <boolean>
}

The do_on string may be set to 1989-12-DD (DD specifies the column, 01 is left). If this is the case, the ToDo entry should be listed in someday.

Updating a ToDo item

POST https://teuxdeux.com/api/update.json

Params:

  • todo_item[item id][position]: Integer; Changes the position of the item
  • todo_item[item id][done]: Integer, 1 or 0 (boolean); Toggles the status
  • todo_item[item id][do_on]: String, format: YYYY-MM-DD; Moves the item to another date

The do_on string may be set to 1989-12-01 for listing in someday.

You can update more than just one item in one request.

Deleting Item

POST https://teuxdeux.com/api/todo/_item id_

Params:

  • _method: "delete" (Using the HTTP Method DELETE directly should work; it's rails)

Response: 200 OK on success. 500 Internal Server Error on unknown ID

Body: no body returned

Something went wrong with that request. Please try again.