© Paul Redmond 2016

Paul Redmond, Lumen Programming Guide, 10.1007/978-1-4842-2187-7_5

5. Creating, Reading, Updating, and Deleting Books

Paul Redmond

(1)Phoenix, Arizona, USA

Now that you have a Books model, you are well-equipped to handle the management of books. You will continue to follow your test-driven development workflow as you complete the remaining CRUD operations of the /books API.

Listing 5-1 shows a quick refresher of your /books RESTful endpoints.

Listing 5-1. Basic REST /books Resource
GET    /books       Get all the booksPOST   /books       Create a new bookGET    /books/{id}  Get a bookPUT    /books/{id}  Update a bookDELETE /books/{id}  Delete a book

Requesting an Individual Book

You are going to start off with the GET /books/{id} ...

Get Lumen Programming Guide: Writing PHP Microservices, REST and Web Service APIs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.