concept GET in category api

This is an excerpt from Manning's book Irresistible APIs: Designing web APIs that developers will love.
To help you see this, I’ll describe an example of the non-RESTful choices made by Flickr. To delete a photo from Flickr, a consumer must make a request to the delete_photo resource related to the photo in question. Originally, this photo would be deleted by sending a GET request to the delete_photo resource. The RESTful way to make a change to the server is to use the appropriate HTTP verb Flickr—in this case, DELETE is the right way to delete a resource, where GET should be used only to read the existing value of a resource. The distinction may seem minor, but when you break these rules you create a situation where your API behaves in an unexpected way for the developers consuming that API. As with designing for the end users of a product, you don’t want to create a situation where the behavior of the system is a surprise to the developer.
Figure 7.6. Because you know what actions will be available at each level, you can add the methods and their descriptions to the schema model. This matches with the information listed earlier; at the list level (/toppings and /pizzas) you can GET the list or POST a new item. At the individual item level (/toppings/:id or /pizzas/:id) you can GET the item, PUT an update, or DELETE the item entirely.
![]()
Figure 7.7. Now that you’ve added the specific actions, it’s time to break them out and add specifics on how the requests and responses will work for them. The GET for the lists is a little bit more complicated than the GETs for the individual items will be, because you’re allowing the caller to search for a specific string.
![]()
Reviewing the methods needed for the individual toppings/{toppingid} and pizzas /{pizzaid} resources, these endpoints will accept GET to obtain information about a single subresource, PUT to update a particular item, and DELETE to remove the topping or pizza.
As demonstrated in figure 7.19, subresource responses for a GET are almost identical to the responses for the top-level resources. An error can occur, though, if the requested pizza ID doesn’t exist. This resource would look similar to this as a URL:
http://api.irresistibleapis.com/pizzas/2
GET—Retrieve the representation of the object or list

This is an excerpt from Manning's book The Design of Web APIs.
Representing goals using REST or any other type of programming interface requires that you first understand how it works. Indeed, what do these
GET,/products/{productId}, or200 OKmean, for example? Without knowing that, you will be unable to actually design such a programming interface. Once you have some basic knowledge, you can analyze the goals and represent them according to the chosen API style. You also have to design data exchanged through the API more accurately than what we did when filling in the API goals canvas. The process is similar to what you do when programming.
Now, what is the HTTP representation of the search action of the catalog resource? The HTTP representation of search for products in catalog using a free query is
GET/products?free-query={free query}, as shown in figure 3.16.Figure 3.16 Search for products in catalog using a free query as an HTTP request
![]()
When we search for products, we want to retrieve them, so we have to use the
GETHTTP method on the/productspath. To only retrieve products matching some query, like a product name or partial description, we need to pass a parameter to this request. AGETHTTP request’s parameters are usually provided as query parameters in the path, as demonstrated in the following listing.Listing 3.1 Query parameter examples
GET /example?param1=value1¶m2=value2 GET /products?free-query=something