Reading-Notes

Reading Notes

API Design Best Practices

What does REST stand for?

Representational State Transfer

REST APIs are designed around a __.

An architectual structuring

What is an identifier of a resource? Give an example.

A resource has an identifier, which is a URI that uniquely identifies that resource. For example, the URI for a particular customer order might be: https://adventure-works.com/orders/1

What are the most common HTTP verbs?

Get, Post, Put, Patch, and Delete

What should the URIs be based on?

A URI must represent an object, uniquely and permanently One of the most fundamental philosophies behind a URI is that it represents a data object on the Internet. The URI must be unique so that it is a one-to-one match – one URI per one data object. https://css-tricks.com/guidelines-for-uri-design/

This same website also mentions it’s a good idea to make it something user friendly; short, to the point, and recognizable.

Give an example of a good URI.

https://adventure-works.com/orders // Good

https://adventure-works.com/create-order // Avoid

What does it mean to have a ‘chatty’ web API? Is this a good or a bad thing?

Being ‘chatty’ basically means there are too many call back requests of the network. When calling for multiple pieces of information, they can be bundled instead of being sparsed out into singular requests. It is a bad thing that ends up bogging down the system by tying it up.

What status code does a successful GET request return?

It retrieves a representation of the resource at the specified URI. The body of the response message contains the details of the requested resource.

What status code does an unsuccessful GET request return?

404 not found

What status code does a successful POST request return?

Creates a new resource at the specified URI. The body of the request message provides the details of the new resource. Note that POST can also be used to trigger operations that don’t actually create resources.

What status code does a successful DELETE request return?

It removes the resource at the specified URI.