Working with the CircleCI API
The CircleCI API documentation is available at https://circleci.com/docs/api/v1-reference/. To get started working with the API you will need to add an API token. We already set an API token in the Setting an API token with CircleCI section of this chapter, so read that section if necessary.
Test CircleCI API connection
We will use the curl
command and our API token to test that we have a good CircleCI API connection:

Here we did not get any response headers or a status code. In order for you to receive those, you need to use the -i
, --include
options with the curl
command.
Using the CircleCI API to get build summary for a single Git repo
We will use the GET /project/:vcs-type/:username/:project
API endpoint to get the build summary information. You can read the documentation for recent builds for a single project at https://circleci.com/docs/api/v1-reference/#recent-builds-project.
In the following screenshot, we use the curl
command to make the REST call and use...