ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14k stars 3.42k forks source link

Limit fields in API output #508

Open lorddaedra opened 6 years ago

lorddaedra commented 6 years ago
ISSUE TYPE
COMPONENT NAME
SUMMARY

Add ability to limit fields in output for all get list requests (get projects list, get inventory list, get job templates list etc.) https://.../?fields=id,description

EXPECTED RESULTS

Will be included only id and description fields in output json.

lorddaedra commented 6 years ago

you use Django rest framework for API, so...

  1. this plugin looks as solution https://github.com/wimglenn/djangorestframework-queryfields docs: http://djangorestframework-queryfields.readthedocs.io/en/latest/ looks easy, add 1 Mixin and some tests...

  2. or you can use some answers here: https://stackoverflow.com/questions/23643204/django-rest-framework-dynamically-return-subset-of-fields