Filter API result by nested field

,

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

3 Likes