# API call to get hosts that had failures

**URL:** <https://forum.ansible.com/t/api-call-to-get-hosts-that-had-failures/29791>\
**Category:** AWX Project\
**Created:** [February 27, 2019, 4:06pm UTC](https://forum.ansible.com/t/api-call-to-get-hosts-that-had-failures/29791 "2019-02-27T16:06:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_Wang](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Andy\_Wang](https://forum.ansible.com/u/Andy_Wang)\
**Post date:** [February 27, 2019, 4:06pm UTC](https://forum.ansible.com/t/api-call-to-get-hosts-that-had-failures/29791/1 "2019-02-27T16:06:38Z")

</div>

Does anyone know an API query to get the hosts that failed for a job? I’ve been looking at the job\_events API but I’m having trouble to come up with a query.

Thank you.

---

<div class="post-metadata">

**Author:** ![Andy\_Wang](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Andy\_Wang](https://forum.ansible.com/u/Andy_Wang)\
**Post date:** [February 27, 2019, 4:28pm UTC](https://forum.ansible.com/t/api-call-to-get-hosts-that-had-failures/29791/2 "2019-02-27T16:28:39Z")

</div>

Found a workaround using jq

curl -u user:password [https://tower-url/api/v2/job\_events/?job=111111](https://tower-url/api/v2/job_events/?job=111111) \> job\_event\_111111.txt

jq ‘.results.summary\_fields.host |select (.has\_active\_failures==true).name’ job\_event\_111111.txt
