-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Description / Steps to reproduce / Feature proposal
- Follow todoList tutorial from working version of todos example
- follow steps to test new api behaviour
Current Behavior
-
POST /todo-listswith a body of { "title": "grocery list" }
curl -X POST "https://lb4.eu-gb.mybluemix.net/todo-lists" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"title\":\"grocery list\"}"
200 OK
{
"id": "f802a73624452ae109f5f67921f029b1",
"title": "grocery list"
}
-
POST /todo-lists/{id}/todosusing the ID you got back from the previous POST request and a body for a todo. Notice that response body you get back contains property todoListId with the ID from before.
curl -X POST "https://lb4.eu-gb.mybluemix.net/todo-lists/f802a73624452ae109f5f67921f029b1/todos" -H "accept: */*" -H "Content-Type: application/json" -d "{\"title\":\"my Todo\",\"desc\":\"todo added via todo-lists/f802a73624452ae109f5f67921f029b1/todos\"}"
200 OK
{
"id": "89457642c79b2bd07c0d09c5e347d1d3",
"title": "my Todo",
"desc": "todo added via todo-lists/f802a73624452ae109f5f67921f029b1/todos",
"todoListId": "f802a73624452ae109f5f67921f029b1"
}
Expected Behavior
As expected until this point.
-
GET /todos/{id}/todosand see if you get the todo you created from before. -
GET /todos/{id}/todosis not a route!
Should there be a routeGET /**todo-list**/{id}/todos?? -
GET /todos/{id}returns the todo:
curl -X GET "https://lb4.eu-gb.mybluemix.net/todos/89457642c79b2bd07c0d09c5e347d1d3" -H "accept: application/json"
200 - OK
{
"id": "89457642c79b2bd07c0d09c5e347d1d3",
"title": "my Todo",
"desc": "todo added via todo-lists/f802a73624452ae109f5f67921f029b1/todos",
"todoListId": "f802a73624452ae109f5f67921f029b1"
}
- The todoList Model is not updated with the todo (or reference to it) on its list:
GET todo-lists/{id}
curl -X GET "https://lb4.eu-gb.mybluemix.net/todo-lists/f802a73624452ae109f5f67921f029b1" -H "accept: application/json"
200 -OK
{
"id": "f802a73624452ae109f5f67921f029b1",
"title": "grocery list"
}
Expected: (minimum of)
{
"id": "f802a73624452ae109f5f67921f029b1",
"title": "grocery list",
"todos": [
{
"id": "89457642c79b2bd07c0d09c5e347d1d3"
}
]
}
@dhmlau FYI