Completing and Deleting Items
Let’s complete the application functionality by adding the two missing features: the complete command to mark an item as done and the del command to delete an item from the list.
According to the to-do REST API requirements, to complete an item you must send an HTTP PATCH request to the endpoint /todo/id?complete, where id is an integer number representing the item in the list. To delete an item from the list, send an HTTP DELETE request to the endpoint /todo/id, where id is again a number that represents the item. For more information on this API’s requirements, see Table 1, To-Do REST API Operations.
To send those requests, you’ll reuse the function sendRequest you implemented for the add command in Adding ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access