Using curl as a REST client

We have already used curl as a REST client throughout the book, so you should be familiar with how to use it by now. We will be making a POST request to the following endpoint https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/follow?circle-token=:token:

curl -X POST "https://circleci.com/api/v1.1/project/github/packtci/circleci-jobs-example/follow?circle-token=$CIRCLECI_API_TOKEN_GITHUB"

Here we use an environment variable called CIRCLECI_API_TOKEN_GITHUB that is set in our local environment, and we get the following response from the API:

{  "following" : true,  "workflow" : false,  "first_build" : {    "compare" : null,    "previous_successful_build" : null,    "build_parameters" : null,    "oss" : true, "committer_date" ...

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.