2
Good afternoon.
I would like to know if there is any standard or good practice (independent of the programming language), for building Web API that allow customization of the content of the response, by the client (user of this API).
Example: A web API with the following resource: http://application/api/clients/100
that would return a JSON in the pattern:
{
"id": "100",
"nome": "nome do cliente 100",
"endereco": "endereço completo do cliente 100"
}
Now imagine that in a particular client of this API, there is a functionality to assemble a client table, where it is necessary to list only the attributes "id" and "name".
A hypothetical solution would be to create another method in the API that returns only the required data. This would prevent the transfer of unnenessary data (in this case the field "address").
However, it does not seem like a good idea to be clogging the API with such specific methods, according to the needs of the clients of this API.
Against this background, the question then is, is there any standard for customizing this return by the customer?
This is ASP.NET Webapi, right?
– Jéf Bueno
vc can pass in the request the names of the fields you want to return by ex http://application/api/clients/100/id:name:address where : is the tab
– Jasar Orion
Where did you get this? @Jasarorion
– Jéf Bueno
he an idea q i t deito change the request in your api
– Jasar Orion