[katello-devel] returning only specific fields when querying API

Joseph Magen jmagen at redhat.com
Mon Jul 15 12:11:14 UTC 2013


hand-written and it gets messy, so I stopped and wanted to find a better way.


----- Original Message -----
From: "Tom McKay" <thomasmckay at redhat.com>
To: "Joseph Magen" <jmagen at redhat.com>
Cc: "katello-devel" <katello-devel at redhat.com>
Sent: Monday, July 15, 2013 2:31:08 PM
Subject: Re: [katello-devel] returning only specific fields when querying API



----- Original Message -----
> From: "Joseph Magen" <jmagen at redhat.com>
> To: "Tom McKay" <thomasmckay at redhat.com>
> Cc: "katello-devel" <katello-devel at redhat.com>
> Sent: Sunday, July 14, 2013 8:03:44 AM
> Subject: Re: [katello-devel] returning only specific fields when querying API
> 
> Hi Tom,
> 
> I have an old branch that implemented this behavior in the Foreman API, but I
> haven't pushed it yet to github.  I plan to rebase upload it soon.
> 
> Joseph
> 

Hand-written or did you find a gem to do it?

> 
> ----- Original Message -----
> From: "Tom McKay" <thomasmckay at redhat.com>
> To: "katello-devel" <katello-devel at redhat.com>
> Sent: Thursday, July 11, 2013 9:01:46 PM
> Subject: [katello-devel] returning only specific fields when querying API
> 
> 
> With the increased usage of katello's API, I am wondering if anyone has
> suggestions for infrastructure to allow fetching of just a subset of an
> objects fields.
> 
> Consider this fictional scenario...
> 
> GET /katello/api/systems
>     {[
>       {
>         id: 1                <- stored in katello, no backend service call
>         name: system1        <- stored in katello, no backend service call
>         running: yes         <- backend service call to foreman
>         entitlements: green  <- backend service call to candlepin
>         new_errata: yes      <- backend service call to pulp
>       },
>       {
>         id: 1                <- stored in katello, no backend service call
>         name: system2        <- stored in katello, no backend service call
>         running: no          <- backend service call to foreman
>         entitlements: green  <- backend service call to candlepin
>         new_errata: yes      <- backend service call to pulp
>       }
>     ]}
> 
> Total service calls:
>     1 call to elasticsearch to get all systems
>     2 calls to foreman
>     2 calls to candlepin
>     2 calls to pulp
> 
> 
> GET /katello/api/systems?fields=[name,running]
>     {[
>       {
>         name: system1        <- stored in katello, no backend service call
>         running: yes         <- backend service call to foreman
>       },
>       {
>         name: system2        <- stored in katello, no backend service call
>         running: no          <- backend service call to foreman
>       }
>     ]}
> 
> Total service calls:
>     1 call to elasticsearch to get all systems
>     2 calls to foreman
> 
> 
> Has anything like this been considered?
> 
> Quick search results:
> https://wiki.mozilla.org/Bugzilla:REST_API#Field_Control
> https://community.attask.com/attask-restful-api
> https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Query+issues#JIRARESTAPIExample-Queryissues-Queryofissueswhilstrestrictingtheresult%27sfields
> 
> _______________________________________________
> katello-devel mailing list
> katello-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/katello-devel
> 
> _______________________________________________
> katello-devel mailing list
> katello-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/katello-devel
> 




More information about the katello-devel mailing list