Azure DevOps – REST APIs – Part 1 – for Projects

Azure DevOPs Rest API - Getting all the projects from the Organization
Azure DevOPs Rest API - Getting all the projects from the Organization

Hi All,

LIFE IS BEAUTIFUL πŸ™‚ I hope we all are safe πŸ™‚ STAY SAFE, STAY HEALTHY,  STAY HOME πŸ™‚

Background: We have started discussing Azure DevOps. In last seven articles of Azure DevOps we discussed

In this article we will move ahead and will discuss REST APIs for DevOps projects. We will access REST APIs from browser and in next upcoming articles we will discuss how we can programmatically access REST APIs

Take away from this article: At the end of this article we will got to know about

  • What are REST APIs
  • What are REST APIs
  • What are REST APIs

Azure DevOps REST APIs scenarios : This is good question πŸ™‚ why we require REST APIs for Azure DevOps services. There are quite few scenarios where I think we can utilize DevOps REST APIs such as

  • Consider Jira Integration, as soon as bug / CR created in Jira, there should be new workitem in DevOps
  • Similarly integration with Service Now tickets
  • Integration with time card applications

Prerequisites :

  • We must have an organization in Azure DevOps.
  • Bit knowledge of REST APIs

What are REST APIs :

  • Microsoft Defines – Representational State Transfer (REST) APIs are service endpoints that support sets of HTTP operations (methods)
  • Azure REST APIs support GET, HEAD, PUT, POST, and PATCH methods
  • These REST APIs can be consumed from browser and get the data in JSON format

Azure DevOps request URI :

  • Format of the Azure DevOps request URI – What are REST APIs
    • instance – The Azure DevOps Services organization. eg. – https://dev.azure.com/{organization}
    • resource path: The resource path is as follows:Β _apis/{area}/{resource}. For exampleΒ _apis/wit/workitems.
    • api-version: api-versions are in the following format:Β {major}.{minor}[-{stage}[.{resource-version}]], for example:
      • api-version=1.0
      • api-version=1.2-preview
      • api-version=2.0-preview.1
    • Best Practice : API versionΒ mustΒ be specified with every request.

Examples :

  • Fetching all the projects in given Organization
https://dev.azure.com/prashamsabadra/_apis/projects?api-version=2.0

count	2

value	
0	
id	"d56fbb79-1205-4688-89c3-cbd13450702b"
name	"Knowledge Junction Intranet"
description	"Intranet application for Knowledge Junction"
url	"https://dev.azure.com/prashamsabadra/_apis/projects/d56fbb79-1205-4688-89c3-cbd13450702b"
state	"wellFormed"
revision	26
visibility	"private"
lastUpdateTime	"2020-08-28T04:28:36.11Z"


1	
id	"42592a57-9732-43bb-818c-9bd3687df0c3"
name	"Managing M365 group lifecycle"
url	"https://dev.azure.com/prashamsabadra/_apis/projects/42592a57-9732-43bb-818c-9bd3687df0c3"
state	"wellFormed"
revision	11
visibility	"private"
lastUpdateTime	"2020-08-16T05:02:44.06Z"
  • If we want specific project details, we can use Project ID or Project name as
https://dev.azure.com/prashamsabadra/_apis/projects/Knowledge%20Junction%20Intranet?api-version=6.0   OR

https://dev.azure.com/prashamsabadra/_apis/projects/d56fbb79-1205-4688-89c3-cbd13450702b?api-version=6.0

result will be : 

id	"d56fbb79-1205-4688-89c3-cbd13450702b"
name	"Knowledge Junction Intranet"
description	"Intranet application for Knowledge Junction"
url	"https://dev.azure.com/prashamsabadra/_apis/projects/d56fbb79-1205-4688-89c3-cbd13450702b"

state	"wellFormed"
revision	26

_links	
self	
href	"https://dev.azure.com/prashamsabadra/_apis/projects/d56fbb79-1205-4688-89c3-cbd13450702b"
collection	

href	"https://dev.azure.com/prashamsabadra/_apis/projectCollections/00c6f6b9-c4b0-4a74-8f11-f923aa9a6525"
web	

href	"https://dev.azure.com/prashamsabadra/Knowledge Junction Intranet"

visibility	"private"

defaultTeam	
id	"4af029c3-ba47-4caf-8f30-a8dde67ef7cb"
name	"Knowledge Junction Intranet Team"
url	"https://dev.azure.com/prashamsabadra/_apis/projects/d56fbb79-1205-4688-89c3-cbd13450702b/teams/4af029c3-ba47-4caf-8f30-a8dde67ef7cb"

lastUpdateTime	"2020-08-28T04:28:36.11Z"

References:

Next Article : In next article we will discuss how to access/call Azure DevOps REST APIs programmatically.

We have very good series going on Azure DevOps. Please have a look once – https://knowledge-junction.com/?s=Azure+DevOps

Thanks for reading πŸ™‚ Feel free to discuss / comment / questions πŸ™‚ . SHARING IS CARING πŸ™‚

Share In Teams:

Enjoy the beautiful life πŸ™‚ Have a FUN πŸ™‚ HAVE A SAFE LIFE πŸ™‚ TAKE CARE πŸ™‚

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

1 Response

  1. March 15, 2021

    […] Azure DevOps – REST APIs – Part 1 – for Projects […]

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: