Good afternoon.
I would like to know if there is any standard or good practice (independent of the programming language) for building Web APIs that allow customization of the content of the response by the client (user of this API).
Example: A web API with the following feature: link
that would return a JSON in the default:
{
"id": "100",
"nome": "nome do cliente 100",
"endereco": "endereço completo do cliente 100"
}
Now imagine that in a certain client of this API, there is a functionality to build a table of clients, where it is necessary to list only the attributes "id" and "name".
One hypothetical solution would be to create another method in the API that returns only the required data. This would prevent the unnecessary transfer of data (in this case the "address" field).
However, it does not seem a good idea to clog the API with such specific methods, depending on the needs of the API clients.
Given this scenario, the question then is, is there any standard for customizing this return by the customer?