todoer
API Documentation¶
-
POST
/logout
¶ Log the current user out.
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – The current user has been logged out.
-
POST
/signup
¶ Sign up a new user.
- Request JSON Object
email (string) – The email address of the new user.
password (string) – A password to associate with the given
email
address.
- Request Headers
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Response JSON Object
email (string) – The email address of the new user.
password (string) – The password of the new user.
- Status Codes
200 OK – A user with the given
email
andpassword
has been created.409 Conflict – There already exists a user with the given
email
.
-
POST
/login
¶ Log in a given user.
- Request JSON Object
email (string) – An email address to log in as.
password (string) – A password associated with the given
email
address.
- Request Headers
Content-Type – application/json
- Response Headers
Content-Type – application/json
Set-Cookie – A
remember_token
.
- Response JSON Object
email (string) – The email address which has been logged in.
password (string) – The password of the user which has been logged in.
- Status Codes
200 OK – A user with the given
email
has been logged in.404 Not Found – No user can be found with the given
email
.401 Unauthorized – The given
password
is incorrect.
-
POST
/todos
¶ Create a new todo item. Requires log in.
- Request Headers
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Request JSON Object
content (string) – The content of the new item.
completed (boolean) – Whether the item is completed.
- Response JSON Object
todo_id (number) – The id of the todo item.
content (string) – The content of the new item.
completed (boolean) – Whether the item is completed.
completion_timestamp (number) – The completion UNIX timestamp (now), or
null
if the item is not completed.
- Status Codes
200 OK – An item with the given details has been created.
-
GET
/todos
¶ List todo items, with optional filters. Requires log in.
- Request Headers
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Response JSON Array of Objects
completed (boolean) – Whether the item is completed.
completion_timestamp (number) – The completion UNIX timestamp, or
null
if there is none.
- Request JSON Object
filter (object) – Mapping of keywords to values to filter by, currently supported is
completed
andtrue
orfalse
.
- Status Codes
200 OK – The requested item’s information is returned.
404 Not Found – There is no item with the given
id
.
-
GET
/todos/
(int: todo_id)¶ Get information about a particular todo item. Requires log in.
- Request Headers
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Parameters
todo_id (number) – The id of the todo item.
- Response JSON Object
completed (boolean) – Whether the item is completed.
completion_timestamp (number) – The completion UNIX timestamp, or
null
if there is none.
- Status Codes
200 OK – The requested item’s information is returned.
404 Not Found – There is no item with the given
id
.
- Return
Details of the requested TODO item.
-
DELETE
/todos/
(int: todo_id)¶ Delete a particular todo item. Requires log in.
- Request Headers
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Parameters
todo_id (number) – The id of the todo item.
- Status Codes
200 OK – The requested item’s information is returned.
404 Not Found – There is no item with the given
id
.
- Return
An empty response.
-
PATCH
/todos/
(int: todo_id)¶ Update a todo item. If an item is changed from not-completed to completed, the
completion_timestamp
is set as now. Requires log in.- Request Headers
Content-Type – application/json
- Parameters
todo_id (number) – The id of the todo item.
- Request JSON Object
content (string) – The new of the item (optional).
completed (boolean) – Whether the item is completed (optional).
- Response Headers
Content-Type – application/json
- Response JSON Object
todo_id (number) – The id of the item.
content (string) – The content item.
completed (boolean) – Whether the item is completed.
completion_timestamp (number) – The completion UNIX timestamp (now), or
null
if the item is not completed.
- Status Codes
200 OK – An item with the given details has been created.
404 Not Found – There is no item with the given
id
.
- Return
Details of the updated todo item.