zeromq / rfc

ZeroMQ RFC project
https://rfc.zeromq.org
109 stars 64 forks source link

Probem: XRAP cannot handle queries and custom meta data #68

Closed sappo closed 9 years ago

sappo commented 9 years ago

I'm currently working on a REST (HTTP) to XRAP gateway which works fine up to a certain point. My first issue is with the query string. REST APIs usually use the query string to allow filtering, sorting, selecting and paging of collections. Currently those query parameters cannot be passed with the GET message. My idea is to extend the GET message with a hash that hold these parameters:

<message name = "GET" id = "3">
    <field name = "resource" type = "string">Schema/typename</field>
    <field name = "parameters" type = "hash">Filtering/sorting/selecting/paging</field>
    <field name = "if modified since" type = "number" size="8">GET if more recent</field>
    <field name = "if none match" type = "string">GET if changed</field>
    <field name = "content type" type = "string">Desired content type</field>
Retrieve a known resource.
</message>

The second issue is with custom metadata that one would attach to a GET_OK or GET_EMPTY. Those metadata may be the total size of a collection in case of paging, the API version or Hypermedia links (HATEOS). My idea is again to extend GET_OK message with a hash:

<message name = "GET OK" id = "4">
    <field name = "status code" type = "number" size = "2">Response status code 2xx</field>
    <field name = "content type" type = "string">Actual content type</field>
    <field name = "content body" type = "longstr">Resource specification</field>
    <field name = "metadata" type = "hash">Custom data:collection size/version/links</field>
Success response for GET.
</message>

These issues are possibly true for POST, PUT and DELETE as well but I currently don't have a use case to verify.

The third issue is regarding etags in GET_OK. A user might not be the creator or modifier of a resource and thus doesn't know the etag of this resource. Hence it would be helpful to pass the etag of a resource with GET_OK as well, so this client can use it as if none match for its next GET request.

sappo commented 9 years ago

@hintjens ping

hintjens commented 9 years ago

Sorry, was in a conference. Send a PR for the spec?

On Thu, Oct 8, 2015 at 6:58 PM, Kevin Sapper notifications@github.com wrote:

@hintjens https://github.com/hintjens ping

— Reply to this email directly or view it on GitHub https://github.com/zeromq/rfc/issues/68#issuecomment-146622959.

sappo commented 9 years ago

Sure I can prepare a PR.

On Fr, Okt 9, 2015 at 3:54 , Pieter Hintjens notifications@github.com wrote:

Sorry, was in a conference. Send a PR for the spec?

On Thu, Oct 8, 2015 at 6:58 PM, Kevin Sapper notifications@github.com wrote:

@hintjens https://github.com/hintjens ping

— Reply to this email directly or view it on GitHub https://github.com/zeromq/rfc/issues/68#issuecomment-146622959.

— Reply to this email directly or view it on GitHub.

hintjens commented 9 years ago

:-) thanks. I'd do it except I'm in an airport catching a flight and exhausted from too much socializing...

On Fri, Oct 9, 2015 at 3:59 PM, Kevin Sapper notifications@github.com wrote:

Sure I can prepare a PR.

On Fr, Okt 9, 2015 at 3:54 , Pieter Hintjens notifications@github.com wrote:

Sorry, was in a conference. Send a PR for the spec?

On Thu, Oct 8, 2015 at 6:58 PM, Kevin Sapper notifications@github.com wrote:

@hintjens https://github.com/hintjens ping

— Reply to this email directly or view it on GitHub https://github.com/zeromq/rfc/issues/68#issuecomment-146622959.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/rfc/issues/68#issuecomment-146879322.

sappo commented 9 years ago

No Problem. Have a good flight.

On Fr, Okt 9, 2015 at 4:11 , Pieter Hintjens notifications@github.com wrote:

:-) thanks. I'd do it except I'm in an airport catching a flight and exhausted from too much socializing...

On Fri, Oct 9, 2015 at 3:59 PM, Kevin Sapper notifications@github.com wrote:

Sure I can prepare a PR.

On Fr, Okt 9, 2015 at 3:54 , Pieter Hintjens notifications@github.com wrote:

Sorry, was in a conference. Send a PR for the spec?

On Thu, Oct 8, 2015 at 6:58 PM, Kevin Sapper notifications@github.com wrote:

@hintjens https://github.com/hintjens ping

— Reply to this email directly or view it on GitHub

https://github.com/zeromq/rfc/issues/68#issuecomment-146622959.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/zeromq/rfc/issues/68#issuecomment-146879322.

— Reply to this email directly or view it on GitHub.