Nick Nick - 10 months ago 69
HTTP Question

Media Types for list endpoints

I've got a REST application with endpoints that return single items and pages of those same kinds of item.

Let's say that the single-item endpoint has a media/content type like this:


And we also currently have a content type for the page structure itself, which looks like this:

I really want to be able to specify what the list is a list of, but I haven't been able to find an acceptable way to say that it's a
. Is there any good way to do this or am I barking up the wrong tree entirely?

Answer Source

You could encode the list and entry type in a single component of the vendor tree part, such as

application/ application/

If your list type of item type already contain a dash, you might have to chose an alternative separator.

Alternatively you could simply transport the list type in the Content-Type: application/ header and use a different one for the item type such as X-Item-Content-Type: application/ for the item type.