To make your solution reusable and flexible, I would suggest implementing the filter request parameter. There you can put any fields required by the client:
GET /customers/123?fields=id,first_name,last_name,email
Thus, if you later need to create another resume for another task, you will have nothing to change.
I would not recommend /customers/123/summary because it was not flexible. This may be good for one case, but if the client needs to access various properties for another case, you will have to configure the resource (most likely, returning more fields than necessary). If you want to “hide” field names, an alternative might be something like this:
GET /customers/123?view=DESCRIPTION
Where " DESCRIPTION " will describe the type of summary. For example:
GET /customers/123?view=addresses_only // eg. returns billing and home address GET /customers/123?view=short // eg. returns only id, first name, last name
This is still flexible as you can easily create new views.
this.lau_
source share