I've created a REST API and I think I'm stuck with a RESTful issue.
It's related with the following questions:
I have a resource called "cases". Cases have also related data, like users and messages. The problem is that I want to get the related queried users and messages data from a case, but I'm not sure with the URI design. There are also different kinds of related/calculated data. These related data should be used to create data visualization.
How I get cases/users/messages are RESTful though:
http://example.com/cases (and with id for a single case)
http://example.com/cases/{id}/users (same idea as above)
http://example.com/cases/{id}/messages (same idea as above)
My first thoughts to create related resources are (I think URI looks wrong, it's maybe getting a bit RPC?):
Related data 1:
http://example.com/cases/{id}/analysis/messages-network-traffic
{
"sender": "an user jack",
"receiver": "an user steph",
"amount_messages": 51
},
{
"sender": "an user test",
"receiver": "an user test4",
"amount_messages": 3
}
...
Related data 2:
http://example.com/cases/{id}/analysis/messages-timeline?receiver=testuser1&sender=testuser2
{
"amount_messages": 24,
"timestamp": 1387321576
},
{
"amount_messages": 50,
"timestamp": 1387321576
}
...
Are these correct thinking of URI design (I think it's kind of RPC though), or how should I do? Because I don't see any reason to CREATE a report resource like the related questions. The data is just a calculation of the existing resources.
Thank you in advance.