How do you solve some doubts about restful?

1) only one operation method can be marked in each rest request (such as GET, POST),), but in fact there may be more than one operation in each request. How do you solve this problem?

for example: in the GET request, the backend actually performs logging or other modification operations, so isn"t the rest specification contaminated

2) each rest request can only request one resource, so if you want a composite resource, such as fetching all the associated data from a specified resource, won"t it also cause rest pollution?

for example:
GET / zoos/1/animal/1;
but actually want to return all the information about the zoo and the company to which animal No. 1 belongs. Is that causing pollution?

there are good restful api specifications or restful specification framework classes are also welcome to recommend!

Jan.08,2022

as far as I understand, the URL of this request only represents that the purpose of this request is to obtain the No. 1 animal in the No. 1 zoo, that is to say, the number one animal is finally returned. Does not mean that nothing else can be done. And then you log in the interface doesn't mean pollution.

if you are good at English, you can google a lot, but if you can't do scientific business, I recommend one: idelines-the-best-practices-60e1d954e7c9" rel=" nofollow noreferrer "> https://hackernoon.com/restfu.

.

then, you can take a look at resource there.

Resource is an object or representation of something, which has some
associated data with it and there can be set of methods to operate on
it. E.G. Animals, schools and employees are resources and delete, add,
update are the operations to be performed on these resources.

Collections are set of resources, e.g Companies is the collection of
Company resource.

URL (Uniform Resource Locator) is a path through which a resource can
be located and some actions can be performed on it.

focus on this sentence: URL is a path that indicates the location of the resource and what actions the resource can be manipulated.

Menu