[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Pulp-list] (Sort of) REST Question

On 09/16/2010 11:19 AM, Jason Dobies wrote:
Hash: SHA1

The consumer history query lets you filter on event type (repo bound,
consumer created, etc). So in the body of the query you'd pass something

{ 'event_type' : 'package_installed' }

I understand a fair amount of the HATEOAS ideas and I know we're using
it in a lot of ways (i.e. a repo sync returning the URL to check its
status). But where does a client get the list of event types that can be

I have an API method to return them; that much was simple. I was going
to add a web service call to it so our CLI could run that separately if
the user wanted more information. But when I couldn't come up with a
good URL to hang that list from, I figured this was probably a common
thing we'd have to deal with.

Right now the consumer history URL looks like:


Would the event type enumeration be something like:


Or is this list of possible values something that only exists in
documentation. I know this sort of thing isn't directly covered by
HATEOAS, but it seems like if you're keeping the client that thin/dumb,
you should also provide a server means for this sort of information.

perhaps for any given document that has different types you can represent that at the top of the list returned from the top level GET:

GET /foos/


'foo-types' : ['TYPE1', 'TYPE2', 'TYPE3'],
'foos' : [{'id': 'my-foo1',
  'name': 'My Foo 1'
  'foo-type': 'TYPE1'},
 {'id': 'my-foo2',
  'name': 'My Foo 2'},
  'foo-type': 'TYPE2']

so in your case it would be:

GET /consumers/<id>/history

'history' : [
  {"originator": "consumer", "timestamp": {"$date": 1283519842366},
    "type_name": "consumer_created", "consumer_id": "jdob", "details":
    null, "_ns": "consumer_history", "_id":
    "9b81254d-cbb3-463d-a7ba-59106e78a5fe", "id":
  {"originator": "consumer", "timestamp": {"$date": 1283519842366},
    "type_name": "repo_bound", "consumer_id": "jdob", "details":
    {"repo_id": "repo1"}, "_ns": "consumer_history", "_id":
    "53dd60e5-ca4b-47b0-8f90-325aeb0da17a", "id":

this would illustrate to the caller the types they can filter on. Or you just include a link at the top of the results

'event_types' : '/pulp/api/consumers/<id>/event_types/'

or something like that.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]