Building the API

A pure REST approach may use all of the HTTP methods detailed in the following table:

HTTP Verb

Sample URI

Task performed

GET

/cities/10

Retrieves the city with ID 10

DELETE

/cities/10

Deletes the city with ID 10

POST

/cities

Creates a new city

PUT

/cities/10

Updates the city with ID 10

PATCH

/cities/10

Performs a partial update to the city with ID 10

OPTIONS

/cities/10

Returns all the available operations on the city with ID 10

HEAD

/cities/10

Returns only the HTTP headers

However, in order to enforce compatibility with old clients of the platform with a restricted set of available HTTP options, we can also choose to be pragmatic and perform every operation with a single verb using HTTP headers ...

Get Mastering Cloud Development using Microsoft Azure 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.