Working with Azure Pipeline APIs 101: Made Easy

Harshitha Balasankula • Last Modified: December 29th, 2022

azure pipeline api: FI

Developers, DevOps teams, and others can use a pipeline to create and deploy dependable code. Azure DevOps has a feature called Azure Pipelines that can be used to create a pipeline in Microsoft.

Azure Pipelines can automate builds, tests, and code deployment to various development and production environments. REST APIs are service endpoints that support a set of HTTP operations that allow users to Create, Retrieve, Update, and Delete resources from a service.

This article talks about the critical aspects of Azure Pipeline APIs. In addition to that, it also describes Azure Pipeline and REST API. It also demonstrates how to create, build and deploy an Azure Pipeline and how the logs and specific artifacts can be retrieved.

Table Of Contents

What is Azure Pipeline?

azure pipeline api: azure pipeline logo
Image Source

Azure Pipelines builds and tests code projects automatically before making them available to others. It can be used with almost any language or project type. To test and build your code and ship it to any target, Azure Pipelines combines Continuous Integration (CI) and Continuous Delivery (CD).

Continuous Integration (CI) is a development practice that automates the merging and testing of code. Implementing CI allows you to catch bugs early in the development cycle, saving you money on bug fixes. To ensure quality, automated tests are run as part of the CI process. To enable frequent deployments, artifacts from CI systems are fed into release processes. The Build service in Azure DevOps Server assists you in setting up and managing continuous integration (CI) for your applications.

azure pipeline api: continuous integration
Image Source

Code is built, tested, and deployed to one or more test and production environments using the Continuous Delivery (CD) process. Quality is improved by deploying and testing in multiple environments. Infrastructure and apps are among the artifacts produced by CI systems. These artifacts are used by automated release processes to distribute new versions and fixes to existing systems. Continuous monitoring and alerting systems provide visibility into the entire CD process.

azure pipeline api: continuous delivery
Image Source

Continuous Testing (CT) is the use of automated build-deploy-test workflows, using a variety of technologies and frameworks, to test your changes continuously in a fast, scalable, and efficient manner, whether on-premises or in the cloud.

azure pipeline api: continuous testing
Image Source

Azure Pipeline is a cloud service that allows you to automatically build and test your code project. The Azure pipeline has many features, such as continuous integration and continuous delivery, that allows you to test and build your code regularly and ship to any target.

Java, JavaScript, Node.js, Python,.NET, C++, Go, PHP, and XCode are all supported by Azure Pipelines.

To build and test your application, Azure DevOps has several tasks. Tasks for developing.NET, Java, Node, Android, Xcode, and C++ applications, for example, are available. Similarly, tasks to run tests using a variety of testing frameworks and services are also available. In your automation, you can also use the command line, PowerShell, or Shell scripts.

Implementing CI and CD pipelines ensure that users have access to consistent and high-quality code. Additionally, Azure Pipelines offers a quick, simple, and secure way to automate the creation and distribution of your projects.

Because Azure Pipelines supports the following scenarios, you should use it:

  • Any language or platform can be used.
  • At the same time, it deploys to various types of targets.
  • Connects to Azure deployments.
  • Builds for Windows, Linux, and Mac.
  • It’s compatible with GitHub.
  • Participates in open-source projects.
azure pipeline api: azure devops logo
Image Source

Replicate Data in Minutes Using Hevo’s No-Code Data Pipeline

Hevo Data, a Fully-managed Data Pipeline platform, can help you automate, simplify & enrich your data replication process in a few clicks. With Hevo’s wide variety of connectors and blazing-fast Data Pipelines, you can extract & load data from 100+ Data Sources like MySQL on Microsoft Azure, and PostgreSQL on Microsoft Azure, REST APIs (and 40+ Free Sources) straight into your Data Warehouse, or any Databases.

To further streamline and prepare your data for analysis, you can process and enrich raw granular data using Hevo’s robust & built-in Transformation Layer without writing a single line of code!

GET STARTED WITH HEVO FOR FREE[/hevoButton]

Hevo is the fastest, easiest, and most reliable Data Replication Platform that will save your engineering bandwidth and time multifold. Try our 14-day full access free trial today to experience an entirely automated hassle-free Data Replication!

What is REST API?

azure pipeline api: rest api logo
Image Source

REST (Representational State Transfer) is a software architectural style that was developed to guide the design and development of the World Wide Web’s architecture. REST establishes a set of guidelines for how an Internet-scale distributed hypermedia system, such as the Web, should be designed. The REST architectural style emphasizes scalability of component interactions, uniform interfaces, component deployment independence, and the creation of a layered architecture to enable caching components to reduce user-perceived latency, enforce security, and encapsulate legacy systems.

REST is a widely accepted set of guidelines for creating stateless, dependable web APIs that have been used throughout the software industry. RESTful is an informal term for a web API that follows the REST constraints. RESTful web APIs are typically based on HTTP methods for accessing resources via URL-encoded parameters and data transmission using JSON or XML.

On the World Wide Web, “web resources” were first defined as URL-identified documents or files. Today’s definition is far more broad and abstract, encompassing an entity or action that can be identified, named, addressed, handled, or performed in any way on the Internet. Requests to a resource’s URI in a RESTful Web service elicit a response with a payload formatted in HTML, XML, JSON, or another format.

The response could, for example, confirm that the resource state has changed. Hypertext links to related resources can also be included in the response. HTTP is the most commonly used protocol for these requests and responses. It supports GET, POST, PUT, and DELETE operations (HTTP methods).

RESTful systems aim for fast performance, reliability, and the ability to grow by reusing components that can be managed and updated without affecting the system as a whole, even while it is running, thanks to the use of a stateless protocol and standard operations.

REST is designed to Boost Performance, Scalability, Simplicity, Modifiability, Visibility, Portability, and Reliability. This is accomplished by adhering to REST principles like Client-server Architecture, Statelessness, Cacheability, Layered Systems, Code on-demand Support, and a Uniform Interface. For a system to be classified as RESTful, it must adhere to these guidelines.

Working with Azure Pipeline APIs

Azure Pipeline APIs: Artifacts

To get a specific artifact from a pipeline run, do the following:

GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs/{runId}/artifacts?artifactName={artifactName}&api-version=6.0-preview.1

With Optional Parameters:

GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs/{runId}/artifacts?artifactName={artifactName}&$expand={$expand}&api-version=6.0-preview.1

URI Parameters

NameInRequiredTypeDescription
organizationpathTruestringThe Azure DevOps organization’s name.
pipelineIdpathTrueintegerint32The pipeline’s ID.
projectpathTruestringProject ID or project name
runIdpathTrueintegerint32ID of the run of that pipeline.
api-versionqueryTruestringThe API version to use. To use this version of the API, set this to ‘6.0-preview.1.’
artifactNamequeryTruestringName of the artifact.
$expandqueryGetArtifactExpandOptionsExpand options. Default is None.

Responses

NameTypeDescription
200 OKArtifactsuccessful operation

Security

accessToken

This is the most basic kind of personal token. The password is the token, and the user name can be anything you want.

Artifact

A pipeline produces artifacts that are collections of files. Artifacts can be used to share files between pipeline stages or between pipelines.

NameTypeDescription
namestringThe name of the artifact.
signedContentSignedUrlSigned url for downloading this artifact
urlstringSelf-referential url
GetArtifactExpandOptions

 This expands the number of choices available for artifacts. By default, it is None.

NameTypeDescription
nonestringNo expansion.
signedContentstringIncludes signed content.
SignedUrl

A signed url that allows anonymous access to private resources for a limited time.

NameTypeDescription
signatureExpiresstringTimestamp when access expires.
urlstringThe URL to allow access to.

What Makes Hevo’s ETL Process Best-In-Class

Providing a high-quality ETL solution can be a difficult task if you have a large volume of data. Hevo’s Automated, No-Code Platform empowers you with everything you need to have for a smooth data replication experience.

Check out what makes Hevo amazing:

  • Fully Managed: Hevo requires no management and maintenance as it is a fully automated platform.
  • Data Transformation: Hevo provides a simple interface to perfect, modify, and enrich the data you want to transfer.
  • Faster Insight Generation: Hevo offers near real-time data replication so you have access to real-time insight generation and faster decision making. 
  • Schema Management: Hevo can automatically detect the schema of the incoming data and map it to the destination schema.
  • Scalable Infrastructure: Hevo has in-built integrations for 100+ Data Sources (with 40+ free sources) that can help you scale your data infrastructure as required.
  • Support for Non-native Sources: Hevo allows the integration of data from non-native sources using Hevo’s in-built REST API & Webhooks Connector.
  • Live Support: Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
SIGN UP HERE FOR A 14-DAY FREE TRIAL

Azure Pipeline APIs: Logs

Logs – Get

To obtain a particular log from a pipeline run, enter the following:

GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs/{runId}/logs/{logId}?api-version=6.0-preview.1

With optional parameters:

GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs/{runId}/logs/{logId}?$expand={$expand}&api-version=6.0-preview.1

URI Parameters

NameInRequiredTypeDescription
logIdpathTrueintegerint32ID of the log.
organizationpathTruestringThe name of the Azure DevOps organization.
pipelineIdpathTrueintegerint32ID of the pipeline.
projectpathTruestringProject ID or project name
runIdpathTrueintegerint32ID of the run of that pipeline.
api-versionqueryTruestringVersion of the API to use. This should be set to ‘6.0-preview.1’ to use this version of the api.
$expandqueryGetLogExpandOptionsExpand options. Default is None.

Responses

NameTypeDescription
200 OKLogsuccessful operation

Log

The log of Azure Pipeline API is as follows:

NameTypeDescription
createdOnstringThe date and time the log was created.
idintegerThe ID of the log.
lastChangedOnstringThe date and time the log was last changed.
lineCountintegerThe number of lines in the log.
signedContentSignedUrlA signed url allowing limited-time anonymous access to private resources.
urlstring

Logs – List

To obtain a list of Azure Pipeline API logs, enter the following command:

GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs/{runId}/logs?api-version=6.0-preview.1

With optional parameters:

GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs/{runId}/logs?$expand={$expand}&api-version=6.0-preview.1

URI Parameters

NameInRequiredTypeDescription
organizationpathTruestringThe name of the Azure DevOps organization.
pipelineIdpathTrueintegerint32ID of the pipeline.
projectpathTruestringProject ID or project name
runIdpathTrueintegerint32ID of the run of that pipeline.
api-versionqueryTruestringVersion of the API to use. This should be set to ‘6.0-preview.1’ to use this version of the api.
$expandqueryGetLogExpandOptionsExpand options. Default

Responses

NameTypeDescription
200 OKLogCollectionsuccessful operation

Definitions

GetLogExpandOptionsExpand options. Default is None.
LogLog for a pipeline.
LogCollectionA collection of logs.
SignedUrlA signed url allowing limited-time anonymous access to private resources.

GetLogExpandOptions

This expands the number of choices for getting logs. By default, it is none.

NameType
nonestring
signedContentstring

LogCollection

This is a collection of logs. They are collected by navigating to the pipeline summary.

NameTypeDescription
logsLog[]The list of logs.
signedContentSignedUrlA signed url allowing limited-time anonymous access to private resources.
urlstringURL of the log.

Azure Pipeline APIs: Create Pipeline

To Build an Azure Pipeline API, enter the following command:

POST https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.0-preview.1

URI Parameters

NameInRequiredTypeDescription
organizationpathTruestringThe name of the Azure DevOps organization.
projectpathTruestringProject ID or project name
api-versionqueryTruestringVersion of the API to use. This should be set to ‘6.0-preview.1’ to use this version of the api.

Request Body

NameTypeDescription
configurationCreatePipelineConfigurationParametersConfiguration parameters of the pipeline.
folderstringFolder of the pipeline.
namestringName of the pipeline.

Responses

NameTypeDescription
200 OKPipelinesuccessful operation

Definitions

ConfigurationTypeType of configuration.
CreatePipelineConfigurationParametersConfiguration parameters of the pipeline.
CreatePipelineParametersParameters to create a pipeline.
PipelineDefinition of a pipeline.
PipelineConfiguration
ReferenceLinksThe class to represent a collection of REST reference links.

ConfigurationType

This explains the Type of Configuration that is used in the Azure Pipeline API.

NameTypeDescription
designerHyphenJsonstringDesigner-JSON.
designerJsonstringDesigner JSON.
justInTimestringJust-in-time.
unknownstringUnknown type.
yamlstringYAML.

CreatePipelineConfigurationParameters

These are the Azure Pipeline API configuration parameters:

NameTypeDescription
typeConfigurationTypeType of configuration.

CreatePipelineParameters

This creates the parameters required to create a Azure Pipeline API.

NameTypeDescription
configurationCreatePipelineConfigurationParametersConfiguration parameters of the pipeline.
folderstringFolder of the pipeline.
namestringName of the pipeline.

Pipeline

This depicts the Azure Pipeline API definition.

NameTypeDescription
_linksReferenceLinksThe class to represent a collection of REST reference links.
configurationPipelineConfiguration
folderstringPipeline folder
idintegerPipeline ID
namestringPipeline name
revisionintegerRevision number
urlstringURL of the pipeline

PipelineConfiguration

NameType
typeConfigurationType

ReferenceLinks

This class encapsulates a collection of REST reference links. Each response from a REST API includes hyperlinks to other related resources.

NameTypeDescription
linksobjectThe readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.

Pipelines – Get

To get an Azure pipeline, with the option of specifying the version, enter the following command:

GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}?api-version=6.0-preview.1

With optional parameters:

GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}?pipelineVersion={pipelineVersion}&api-version=6.0-preview.1
URI Parameters
NameInRequiredTypeDescription
organizationpathTruestringThe name of the Azure DevOps organization.
pipelineIdpathTrueintegerint32The pipeline ID
projectpathTruestringProject ID or project name
api-versionqueryTruestringVersion of the API to use. This should be set to ‘6.0-preview.1’ to use this version of the api.
pipelineVersionqueryintegerint32The pipeline version
Responses
NameTypeDescription
200 OKPipelinesuccessful operation
Definitions
ConfigurationTypeType of configuration.
PipelineDefinition of a pipeline.
PipelineConfiguration
ReferenceLinksThe class represents a collection of REST reference links.

Pipelines – List

To create an Azure pipeline API list, enter the following command:

GET https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.0-preview.1GET https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.0-preview.1

With optional parameters:

GET https://dev.azure.com/{organization}/{project}/_apis/pipelines?orderBy={orderBy}&$top={$top}&continuationToken={continuationToken}&api-version=6.0-preview.1
URI Parameters
NameInRequiredTypeDescription
organizationpathTruestringThe name of the Azure DevOps organization.
projectpathTruestringProject ID or project name
api-versionqueryTruestringVersion of the API to use. This should be set to ‘6.0-preview.1’ to use this version of the api.
$topqueryintegerint32The maximum number of pipelines to return
continuationTokenquerystringA continuation token from a previous request, to retrieve the next page of results
orderByquerystringA sort expression. Defaults to “name asc”
Responses
NameTypeDescription
200 OKPipeline[]successful operation
Definitions
ConfigurationTypeType of configuration.
PipelineDefinition of a pipeline.
PipelineConfiguration
ReferenceLinksThe class to represent a collection of REST reference links.

Azure Pipeline APIs: Run the Pipeline

To activate a Azure Pipeline API, enter the following command:

POST https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1

With optional parameters:

POST https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?pipelineVersion={pipelineVersion}&api-version=6.0-preview.1

URI Parameters

NameInRequiredTypeDescription
organizationpathTruestringThe name of the Azure DevOps organization.
pipelineIdpathTrueintegerint32The pipeline ID.
projectpathTruestringProject ID or project name
api-versionqueryTruestringVersion of the API to use. This should be set to ‘6.0-preview.1’ to use this version of the api.
pipelineVersionqueryintegerint32The pipeline version.

Request Body

NameTypeDescription
previewRunbooleanIf this is the case, don’t start a new run. Instead, after parsing templates, return the final YAML document.
resourcesRunResourcesParametersThe resources the run requires.
stagesToSkipstring[]
templateParametersobject
variables<string,  Variable>
yamlOverridestringYou can optionally supply different YAML when using the preview run option. This allows you to see how the final YAML document will look before committing any changes.

Responses

NameTypeDescription
200 OKRunsuccessful operation

Definitions

BuildResourceParameters
NameType
versionstring
ContainerResourceParameters
NameType
versionstring
PackageResourceParameters
NameType
versionstring
PipelineReference

This depicts a reference to a pipeline. It contains data objects that are used to describe a pipeline.

NameTypeDescription
folderstringPipeline folder
idintegerPipeline ID
namestringPipeline name
revisionintegerRevision number
urlstring
PipelineResourceParameters
NameType
versionstring
ReferenceLinks

A collection of REST reference links are represented by this class. Every REST API has links that help a link relating one URL with another

NameTypeDescription
linksobjectThe readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.
Repository
NameType
typeRepositoryType
RepositoryResource
NameType
refNamestring
repositoryRepository
versionstring
RepositoryResourceParameters
NameTypeDescription
refNamestring
tokenstringThis is the security token to use when connecting to the repository.
tokenTypestringOptional. This is the type of the token given. If not provided, a type of “Bearer” is assumed. Note: Use “Basic” for a PAT token.
versionstring
RepositoryType
NameType
azureReposGitstring
azureReposGitHyphenatedstring
gitHubstring
unknownstring
Run
NameTypeDescription
_linksReferenceLinksThe class to represent a collection of REST reference links.
createdDatestring
finalYamlstring
finishedDatestring
idinteger
namestring
pipelinePipelineReferenceA reference to a Pipeline.
resourcesRunResources
resultRunResult
stateRunState
urlstring
variables<string,  Variable>
RunPipelineParameters

These are the settings that you need to adjust as they affect the execution of Azure pipeline API.

NameTypeDescription
previewRunbooleanIf true, don’t actually create a new run. Instead, return the final YAML document after parsing templates.
resourcesRunResourcesParametersThe resources the run requires.
stagesToSkipstring[]
templateParametersobject
variables<string,  Variable>
yamlOverridestringIf you use the preview run option, you may optionally supply different YAML. This allows you to preview the final YAML document without committing a changed file.
RunResources
NameType
repositories<string,  RepositoryResource>
RunResourcesParameters
NameType
builds<string,  BuildResourceParameters>
containers<string,  ContainerResourceParameters>
packages<string,  PackageResourceParameters>
pipelines<string,  PipelineResourceParameters>
repositories<string,  RepositoryResourceParameters>

RunResult

NameType
canceledstring
failedstring
succeededstring
unknownstring

RunState

NameType
cancelingstring
completedstring
inProgressstring
unknownstring

Variable

NameType
isSecretboolean
valuestring

Conclusion

This article discusses the Azure Pipeline APIs extensively. It also gives a brief introduction to Azure Pipeline and REST API. It also shows how to create and run a pipeline using the Azure REST API, as well as how to retrieve logs and specific artifacts.

visit our website to explore hevo

Hevo Data, a No-code Data Pipeline provides you with a consistent and reliable solution to manage data replication from a variety of sources like MySQL on Microsoft Azure, MySQL on Microsoft Azure, and PostgreSQL on Microsoft Azure, into a wide variety of destinations, with a few clicks.

Hevo Data with its strong integration with 100+ Data Sources (including 40+ Free Sources) allows you to not only export data from your desired data sources & load it to the destination of your choice, but also transform & enrich your data to make it analysis-ready. Hevo also allows the integration of data from non-native sources using Hevo’s in-built REST API & Webhooks Connector so that you can focus on your key business needs and perform insightful analysis using BI tools.

Want to take Hevo for a spin? 

Sign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs.

No-code Data Pipeline For Your Data Warehouse