November 2018
Intermediate to advanced
404 pages
10h 16m
English
To delete a specific item, you just need to provide the item's ID and call the delete() method of the model:
// delete an item by IDfunc deleteItemHandler(id: Int, completion: @escaping(RequestError?) -> Void) { JournalItem.delete(id: id, completion)}
Use curl to delete one of the existing items:
$ curl --request DELETE http://localhost:8080/api/admin/1
Then run the curl command again to retrieve the specific item:
$ curl http://localhost:8080/api/admin/1
Nothing is printed on the screen. The deleteItemHandler(id:completion:) handler works as expected!
Read now
Unlock full access