Calling a REST API from Azure Release Pipeline

Hansel
Bina Nusantara IT Division
3 min readDec 21, 2022

When releasing an application using the CI/CD cycle provided by the pipelines in Azure DevOps, there comes a time when every time the application is released, calling another existing REST API might be useful.

Photo by Nadir sYzYgY on Unsplash

This handy feature could be used to automate the process of documenting the time when an application is released or to document all of the endpoints that an application has and put those data straight into a database. In this article, I’m going to show you a simple way to do just that.

First of all, add a new Agentless job to the deployment process and add a task called “Invoke a REST API”

Photo by Author
Photo by Author

Next, if there are no available Generic service connection already, click on the “Manage” button to create a new one.

Photo by Author

In the Service Connections page, click the “New Service connection” button, pick Generic, and scroll to the bottom to click on Next.

Photo by Author

Then, fill in the Server URL of the REST API that we wanted to hit. For this example, we want to make a POST request to an API that records the deployment time of other APIs, with the url https://someurl.com/api_documentation we would put in https://someurl.com and put in the service connection name, we can name it whatever we like and save it.

Photo by Author

Finally, return to the tasks page and fill in the fields such as Method, Headers, Body, URL suffix and parameters according to the request that wanted to be made and click on save. Here is an example:

Photo by Author

That’s it! Now every time the application is deployed, it would make an API request and send the provided data accordingly. Information about the current time can later be obtained from the logic inside the API.

--

--