Extensions to REST-API
Ralf Schlatterbeck <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm currently missing some more things in the REST API before it becomes
really useful:
- The ability to look up keys of items in the database, e.g., say I want
to find the status with the name 'closed'. Now I'd have to perform a
search with something like:
.../data/status?name=closed
and then loop over the results, fetching each item in turn and compare
the name. The string search is a case insensitive substring search and
will find stati where the name includes the string 'closed'. So if we
have another status with the name 'almost closed' it will also be
found (because it contains the substring 'closed').
IMO this should be extended to allow key attributes directly in the
URL, e.g. .../data/status/closed
Now this would work only for classes that have a key attribute (so we
can't search for issue title this way) but would be nice for finding a
certain status or a user (.../data/user/example_username)
- The query on a class should directly yield the attributes if
requested, so if we specify, say, @verbose=3 we would get all
attributes (except for content) along with the query, e.g.
/data/status?@verbose=3 would yield
'data' :
'@total_size': '3'
, 'collection':
[ { 'link': ...
, 'id': '1'
, 'name': 'open'
, 'attributes' :
{ 'name' : ...
, ...
}
}
, ...
]
If this is not possible we're wasting a lot of roundtrip time to
request each item of which we only have the id (and the label property
if @verbose is >1 according to Johns latest update) in turn. Similar
to the same problem in XMLRPC and in the native roundup API (which
does a separate database request for each item).
What do you think?
One of the problems I'm seeing is different values of @verbose on
/data/issue and /data/issue/1 have different meaning with this
implementation. So maybe we never put the label property in there
(currently as implemented with @verbose>1), use @verbose=1 for the
output example above, make @verbose=1 the default (as in /data/issue/1),
provide the old output with @verbose=0 and add links to other items with
@verbose=2 and content with @verbose=3 like when requesting a single
issue? We could also allow pruning the attributes by specifying an
explicit @attributes parameter (also proposed by John some time ago).
Ralf
--
Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16
Open Source Consulting www: http://www.runtux.com
Reichergasse 131, A-3411 Weidling email: [email protected]