Jul 30, 2015
0
Level 5
Add custom section to a resource
Hi,
I'm using Fractal for my api. I'm trying to include a custom section on my response that would be appended to my collection and give me some stats about the response.
An example : If I'm getting messages, I currently get a response with messages and pagination, great... But I can't figure out is how to append a customized section that would give stats about my messages (read, latest...).
To get something like that :
{
"messages" : [ {...}, {...}, ....],
"pagination": {...},
"stats": {
"unread" : 3,
"whatever": 5,
}
}
Do you have any idea on how to handle that ??
Thanks !
Please or to participate in this conversation.