Skip to content

Latest commit

 

History

History
60 lines (28 loc) · 2.15 KB

File metadata and controls

60 lines (28 loc) · 2.15 KB

RESTful web API design

A well-designed web API should aim to support:

  • Platform independence. Any client should be able to call the API, regardless of how the API is implemented internally. This requires using standard protocols, and having a mechanism whereby the client and the web service can agree on the format of the data to exchange.

  • Service evolution. The web API should be able to evolve and add functionality independently from client applications. As the API evolves, existing client applications should continue to function without modification. All functionality should be discoverable so that client applications can fully use it.


What does REST stand for?

Representational State Transfer (REST)

REST APIs are designed around a ____.

resource has an identifier

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

which is a URI that uniquely identifies that resource.

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

What are the most common HTTP verbs?

The most common operations are GET, POST, PUT, PATCH, and DELETE.

What should the URIs be based on?

resource URIs should be based on nouns (the resource) and not verbs (the operations on the resource).

Give an example of a good URI.

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

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

chatty web APIs expose a large number of small resources,its a bad thing because all web requests impose a load on the web server. The more requests, the bigger the load.

What status code does a successful GET request return?

A successful GET method typically returns HTTP status code 200 (OK).

What status code does an unsuccessful GET request return?

If the resource cannot be found, the method should return 404 (Not Found).

What status code does a successful POST request return?

it returns HTTP status code 201 (Created).

What status code does a successful DELETE request return?

the web server should respond with HTTP status code 204 (No Content).