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

Joseph Magen jmagen at redhat.com
Sun Jul 14 12:03:44 UTC 2013


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


----- 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




More information about the katello-devel mailing list