6

I have resources like this

/entities        # GET, POST
/entities/<id>   # GET, PUT, DELETE

GET /entities gets the list of all entities. Now I want to poll for updates. The case for a single entity is straight forward:

GET /entities/2
If-Modified-Since: <http date>

The list is tricky. I want the response to be a list of entities, updated or created since a given point in time. I'd intuitively use

GET /entities
Range: after <http date>

Which is a valid request by HTTP specification http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.2 . But the spec also mandates a 206 Partial Content response, which has to include a Content-Range header. A Content-Range header, in turn, mandates a byte range to be specified http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16 . This is obviously very inconvenient for my use case.

How would you request a semantic range over HTTP?

4
  • are you sure Range can be used with a date? Section 14.35.1 only discusses byte ranges. Commented Oct 23, 2011 at 20:34
  • I agree with @adrift, I can find no reference anywhere in any RFC to Range: after <http date> being valid in HTTP/1.1 - if it were, the Content-Range: header would be defined to accomodate for it, otherwise the practice would only be half defined. Commented Oct 23, 2011 at 21:47
  • The Httpbis spec seems to have a bit more details about non-byte ranges tools.ietf.org/html/draft-ietf-httpbis-p5-range-16 Commented Oct 23, 2011 at 23:43
  • See also w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.12 Commented Oct 24, 2011 at 14:01

1 Answer 1

2

From reading section 14.35.1, I would say that the Range header is used to request a specific range of bytes from a resource, not to request a group of entities according to when they were modified.

In this case, I believe you should treat your range as a filter and pass the date as a query string parameter:

GET /entities?modified-since=<date>
Sign up to request clarification or add additional context in comments.

1 Comment

That's what I concluded too. Non byte ranges seem to be allowed for sake of future compatibility, but very underspecified.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.