Azure DevOps RestAPI using Postman

Indira Raghavan
3 min readSep 10, 2020

--

Use Postman to retrieve the organization or Project repository information from Azure DevOps API

Postman + Azure Devops API

If you have used Azure Devops — as a developer, Project lead, Project Manager — its a pain to navigate to the Pull requests tab, get the details of PR’s, reviewers, and other information for it. Though DevOps being wholesome one source of truth tool to keep track of all information, it still has a lot of clutter when we are looking for specific information. Too many buttons to push to filter the information.

In-comes azure-devops-rest-6.0

Azure Devops provides RestAPI to get the information about projects, repositories, PR’s, Pipelines etc. Almost every functional aspect can be isolated and retrieved to analyse without additional information. Also some organizations may need the information labelled and printed out into a different reporting format(I am saying Excel😒 ). Lets see how to get the information using the Azure Devops API reference.

I am working here with api version 6.0, specifically to retrieve repositories, please click here for additional query parameters, search criteria etc.

Required elements:

  1. Project url : obtained from your DevOps boards
  2. Personal Access Token: Generate one with valid scope and expiration dates
  3. Tool to send the request: such as postman

Let’s get to work…

  1. Project url:

This is the url for your private or work organization, something like this:

project repo

For my organization I would replace the default values like this:

Default: https://dev.azure.com/{organization}/{project}/_apis/git/repositories?api-version=6.0

For e.g.,:

https://dev.azure.com/indiraraghavan/Paradigm/_apis/git/repositories?api-version=6.0

This call will get all repositories under {project}, under my organization.

2. Personal Access Token:

You can generate PAT using DevOps user settings:

Go to Personal Access Tokens under user settings

PAT1

Create a New token with required access and scopes: Make sure to copy it to your local safe place. DevOps doesn’t store this value. and there is no way to retrieve it.

PAT 2

3. Let’s go to Postman:

I am using Postman tool to retrieve the information. You can create .Net or Nodejs or any project to run a get query with the url and the basic authentication.

Create a new request tab on Postman and enter your project url requesting the repositiories.

Post man

VERB: Get call

URL: Organization URL

Authorization tab: Basic Auth and leave username blank and enter only PAT as password

Hit Send.

You will receive response as a json formatted. We can utilize this for any kind of filtering etc.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Indira Raghavan
Indira Raghavan

Responses (1)

Write a response