[openstack-dev] [api] Counting resources

Eoghan Glynn eglynn at redhat.com
Mon Dec 1 10:36:57 UTC 2014



> detail=concise is not a media type and looking at the grammar in the RFC it
> wouldn’t be valid.
> I think the grammar would allow for "application/json; detail=concise". See
> the last line in the definition of the "media-range" nonterminal in the
> grammar (copied below for convenience):
> Accept         = "Accept" ":"
>                         #( media-range [ accept-params ] )
> media-range    = ( "*/*"
>                         | ( type "/" "*" )
>                         | ( type "/" subtype )
>                         ) *( ";" parameter )
>        accept-params  = ";" "q" "=" qvalue *( accept-extension )
>        accept-extension = ";" token [ "=" ( token | quoted-string ) ]
> The grammar does not define the "parameter" nonterminal but there is an
> example in the same section that seems to suggest what it could look like:
> Accept: text/*, text/html, text/html;level=1, */*
> Shaunak
> On Nov 26, 2014, at 2:03 PM, Everett Toews < everett.toews at RACKSPACE.COM >
> wrote:
> 
> 
> 
> 
> On Nov 20, 2014, at 4:06 PM, Eoghan Glynn < eglynn at redhat.com > wrote:
> 
> 
> 
> How about allowing the caller to specify what level of detail
> they require via the Accept header?
> 
> ▶ GET /<prefix>/<resource_name>
> Accept: application/json; detail=concise
> 
> "The Accept request-header field can be used to specify certain media types
> which are acceptable for the response.” [1]
> 
> detail=concise is not a media type and looking at the grammar in the RFC it
> wouldn’t be valid. It’s not appropriate for the Accept header.

Well it's not a media type for sure, as it's intended to be an
"accept-extension".

(which is allowed by the spec to be specified in the Accept header,
 in addition to media types & q-values)

Cheers,
Eoghan
 
> Everett
> 
> [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



More information about the OpenStack-dev mailing list