Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #7059 - enable pagination in subscriptions (API) #4572

Merged
merged 1 commit into from Aug 15, 2014

Conversation

mbacovsky
Copy link
Contributor

No description provided.

@@ -35,6 +35,8 @@ class Api::V2::SubscriptionsController < Api::V2::ApiController
param :organization_id, :number, :desc => N_("Organization ID"), :required => true
param :system_id, String, :desc => N_("UUID of the system"), :required => false
param :activation_key_id, String, :desc => N_("Activation key ID"), :required => false
param :page, String, :desc => N_("paginate results")
param :per_page, String, :desc => N_("number of entries per request")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't these already included? https://github.com/Katello/katello/blob/master/app/controllers/katello/api/v2/api_controller.rb#L36

I believe the subscriptions controller index should work if do this/katello/api/v2/organizations/1/subscriptions?page=4&per_page=3

If you want the entire result you can pass in full_result=true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out. It seems that the search param group is defined in the ApiController but has to be added manually. That is at least what I saw in e.g. PackagesController and how it behaves in my instance.

@waldenraines
Copy link
Contributor

Thanks for pointing that out. It seems that the search param group is defined in the ApiController but has to be added manually. That is at least what I saw in e.g. PackagesController and how it behaves in my instance.

I get the following in master without your change:

[walden@wraines-sandbox katello (master)]$ curl -u admin:changeme 'http://<redacted>/katello/api/v2/organizations/1/subscriptions?page=1&per_page=1'
{"total":2,"subtotal":2,"page":"1","per_page":"1","search":null,"sort":{"by":null,"order":null},"results":[{"organization":{"name":"Default Organization","label":"Default_Organization"},"id":"ff80808147d4c12d0147d4cdb3e3016d","product_name":"Red Hat Employee Subscription","start_date":"2013-04-24","end_date":"2022-01-01","available":1,"quantity":1,"consumed":0,"account_number":"1212729","contract_number":"10169839","support_level":"SELF-SUPPORT","product_id":"ES0113909","virt_only":false,"sockets":128,"ram":0,"instance_multiplier":null,"stacking_id":"","multi_entitlement":false}]}```

@mbacovsky
Copy link
Contributor Author

@waldenraines, I agree, for curl it works. but if you check API docs it is missing there. In CLI and (API bindings) we use the API documentation to build the CLI arguments. So if it is missing in the docs it is missing form the CLI. So in my PR I just updated the docs to match the API. Makes sense?

@waldenraines
Copy link
Contributor

@mbacovsky oh, I see, ACK.

waldenraines pushed a commit that referenced this pull request Aug 15, 2014
Fixes #7059 - enable pagination in subscriptions (API)
@waldenraines waldenraines merged commit 0561e75 into Katello:master Aug 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants