Obtaining the job ID via an API call to the /builds endpoint

You can also obtain a job ID by calling the /builds endpoint in the Travis API. You will need to make a GET request and provide a valid access token in order to make the REST call. Here is a sample request using the curl REST client:

curl -s -X GET \  -H "Content-Type: application/json" \  -H "Accept: application/json" \  -H "Travis-API-Version: 3" \  -H "Authorization: token $(travis token)" \  -d '{ "quiet": true }' \ https://api.travis-ci.org/builds

This will fetch all the builds that are associated with the repository, which could potentially be a big JSON payload. You can use the jq (https://stedolan.github.io/jq/) command line JSON processor to filter out the job ID information. ...

Get Hands-On Continuous Integration and Delivery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.