# Filter API result by nested field

**URL:** <https://forum.ansible.com/t/filter-api-result-by-nested-field/6014>\
**Category:** Get Help\
**Tags:** api, awx\
**Created:** [May 27, 2024, 6:42am UTC](https://forum.ansible.com/t/filter-api-result-by-nested-field/6014 "2024-05-27T06:42:44Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [May 29, 2024, 7:00pm UTC](https://forum.ansible.com/t/filter-api-result-by-nested-field/6014/8 "2024-05-29T19:00:27Z")

</div>

On the contrary, this is possible.

If you browse to `/api/v2/workflow_approvals/` on your instance, and click the “options” button, it will show you the valid `search_fields` and `related_search_fields`. You can search nested values of valid objects using double underscores.

So for example, you can use this to filter all approved/denied workflows by a given username:  
`/api/v2/workflow_approvals/?approved_or_denied_by__username=foo_user`  
or by id `/api/v2/workflow_approvals/?approved_or_denied_by__id=2`

Similarly, if you’re wanting pending approvals _launched_ by a particular user:  
`/api/v2/workflow_approvals/?status=pending&created_by__username=foo_user`

---

_[View the full topic](https://forum.ansible.com/t/filter-api-result-by-nested-field/6014)._
