I'd like to know your thoughts on which version of this endpoint will be better, and your thoughts on the general format of the response. Want to make sure we are all on board with how the meta
section will look like.
For reference: PEEPS-1612
GET /people/analytics?owner_id=WF&updated_since=2016-01-13T12:39:50Z
{
data: [
{ ... }, # account hash
{ ... }
],
errors: {},
meta: {
next_page_id: "kajsdnkaj12345rtfdchbbusw37489qiksda~-aksjdn",
total: 1000
}
}
Use the next_page_id
from the last request as a query param on the next request
GET /people/analytics?owner_id=WF&next_page_id=kajsdnkaj12345rtfdchbbusw37489qiksda~-aksjdn
{
data: [
{ ... }, # account hash
{ ... }
],
errors: {},
meta: {
next_page_id: "poiuytrewq129348reuw21qwqieh0", # when this is nil, this is the last page
total: 1000
}
}
GET /people/analytics?owner_id=WF&updated_since=2016-01-13T12:39:50Z
{
data: [
{ ... }, # account hash
{ ... }
],
errors: {},
meta: {
next_page_url: "http://secure.westfield.io/v1/people/analytics?owner_id=WF&next_page_id=oiuy67890wiury",
total: 1000
}
}
Use the next_page_url
from the last response to get to the next page of results
GET http://secure.westfield.io/v1/people/analytics?owner_id=WF&next_page_id=oiuy67890wiury
{
data: [
{ ... }, # account hash
{ ... }
],
errors: {},
meta: {
next_page_id: "http://secure.westfield.io/v1/people/analytics?owner_id=WF&next_page_id=oiuy67890wiury",, # when this is nil, this is the last page
total: 1000
}
}
I think next_page_id is more flexible, if less abstract.
Providing the complete URL makes a large assumption, which that all clients can use URLs directly.
This is not true of the SDKs, for example, which would have to parse the next_page_id out of the URL in order to make the next request.