To start off, I need to describe what we have already; we have a set of URL conventions used in: https://github.com/rubyservices/restful_json including (though there are others):
filter:
https://example.org/foobars?foo_id=123
filter greater than:
https://example.org/foobars?bar_date!gt=2012-08-08
filter greater than and return record count:
https://example.org/foobars?bar_date!gt=2012-08-08&count=
filter on "named attribute" (not a real resource field- represents a field of a direct or indirect relation defined server-side) and return unique (distinct) records:
https://example.org/foobars?and_one_more=an_attribute_value_on_my_assocs_assocs_assoc&uniq=
using the server-defined page size, return page count:
https://example.org/foobars?page_count=
return page at specific number, using server-determined page size:
https://example.org/foobars?page=1
range/more flexible paging:
https://example.org/foobars?skip=30&take=15
There are good reasons not to try to promote generalized querying for a variety of security and performance reasons, which is why we try to only provide each ability of the controller when the developer enabled that feature.
These are common relational DB concepts, so when each is enabled, it would be nice to have a standard agreed upon way of constructing a URL like used in that project. The ARel syntax used may not be optimal and could conflict with attribute/column names and require work in the model layer in those rare cases, but it works as a first cut.
The following http://jsonapi.org/extending/ provides an example for paging and it sounds like more examples of metas/profiles for the spec are under construction.
So, some questions:
- Is there going to be an official list of methods for defining a common subset of all of the extensions (profiles) as suggestions? It would be great to get people to agree on filtering, etc. similar to what we have above or to change our framework to work like some agreed-upon spec. They aren't going to keep adding them all to section 5 of RFC 6906. i.e. should there be a place to list common profiles/meta URLs, and how would that be administered?
- How do we avoid bloat of N metas/profiles in each response? Should things like all of the above features (filtering, paging, etc.) be a single profile URL (a group) or individual meta URLs?
- Is there going to be a suggested best practice for profile URLs to contain a version number in the profile URL? Could it be suggested to allow rational versions and suggest that client and server frameworks support partial matching of those versions, similar to gem versioning?: http://docs.rubygems.org/read/chapter/7 That way, enhanced versions of profiles could be provided where the URL of the profile changes, but the client could know that what they are doing is still compatibile, e.g.:
The client originally was developed to work with v1.2.3 of the profile http://api.example.com/simple-querying
which came back at the time with:
{
"meta": {
"profile": "http://api.example.com/simple-querying?v=1.2.3"
},
...
}
But later the API is changed slightly to fix a bug in a way that is still compatible with v1.2 of the API, so it returns the profile http://api.example.com/simple-querying?v=1.2.4
(perhaps some gem being used on the Rails server-side was updated). The client could continue to work without changes since it will continue to function as before for any version that starts with 1.2. This version potentially could even be the gem version itself that implements that functionality.
In summary, I'm wondering if (1) supporting extension for querying, etc. such as I've described above will bloat the response with profile URLs in the meta section, (2) whether there will be centralized administration to suggest commonly used profiles (like those used for querying as mentioned above, or perhaps some other standard for it), and (3) whether a rational profile versioning policy for profiles should be explicitly stated in the spec.
Thanks!