O'Reilly logo

Lumen Programming Guide: Writing PHP Microservices, REST and Web Service APIs by Paul Redmond

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Paul Redmond 2016

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

4. Starting the Books API

Paul Redmond

(1)Phoenix, Arizona, USA

In this chapter, we will focus on writing our first API resource: /books. We will take this in small chunks and test it as we go. At the end of the next few chapters we will have a fully-tested /books resource doing basic CRUD operations. The /books resource will look like this:

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

Creating the First Endpoint

The first order of business to create a BooksControllerTest class and write your first failing test. You will then write the minimum ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required