Resource Identifiers

A resource identifier, also known as a URI (Uniform Resource Identifier), is a string of characters used to identify a resource on the web. It is an essential component of RESTful APIs as it allows clients to interact with specific resources by targeting their unique identifiers.

When designing a flights API, it is crucial to define resource identifiers that accurately represent the resources you want to expose. For example, in our flights API, we may have resources like airports, flights, and bookings. Each of these resources will have a unique identifier to distinguish them from one another.

Resource identifiers in RESTful APIs are not limited to just retrieving information. They can also be used for creating, updating, and deleting resources. For example, if a client wants to create a new booking in our flights API, they can send a POST request to the /bookings endpoint, which represents the collection of bookings. The server then generates a unique identifier for the newly created booking and returns it to the client as part of the response. This new identifier can be used by the client to retrieve, update, or delete the booking in the future.

Complete and Continue  
Discussion

0 comments