Using an API to return dataset records based on id

I’m using APIs that are mostly based on datasets, in order to get consistent data. Only 1 API should return fake, mocked data, with the records it links to via FKs being consistent.

I have a few questions:

  • I would like to be able to return the correct item for a given id. For example, in my dataset I have a record with id 100. If the user users /api/thingy/100, I’d like it to return the record I have with id 100. Currently, given my schema uses sequential records, if I use the example given for modifying a response, it simply changes the id of the response to the value requested, but the actual data remains the same. This isn’t ideal as I would like cross-data consistency for some of the APIs.
  • Is it possible to specify an offset for returning rows, so that the client of the API could do paging. E.g. you could specify count=10&offset=10, which would return rows 11-20.
  • Can you allow the user to specify data ranges in their query, and return appropriate data?

Thanks for any support!
Aled

2 Likes