I have a collection response which gives back an array of user objects and want to have different values for the user attributes without to create multiple user objects. Is there a way to do this?
# Group Users
## Users Collection [/api/v1/users]
### View Users [GET]
+ Request (application/vnd.api+json)
+ Headers
Accept: application/vnd.api+json
Authorization: Bearer JWT
+ Response 200 (application/vnd.api+json)
+ Attributes
+ meta (UsersMetaData)
+ data (array[User, User])
+ links (UserLinks)
# Data Structures
## User
+ type: users (string, required, fixed)
+ id: 1 (number, required)
+ attributes (UserAttributes, required)
## UserAttributes
+ email: test@test.com (string)
+ confirmed: false (boolean)
+ first_name: Melanie (string)
I don't want to create multiple user data structures to avoid an overload. But maybe there is a way to create sample arrays or something to do this in an easy way?
Edit: I just found out this way, in case someone has the same or similar question:
+ Response 200 (application/vnd.api+json)
+ Attributes
+ data (array)
+ (User)
+ attributes (UserAttributes)
+ email: `another@mail.com` (string)
+ confirmed: true (boolean)
+ (User)
+ attributes (UserAttributes)
+ first_name: Darth Vader
This way it is possible to rewrite just the attributes for each object without the need to create new ones.