0
votes

I am calling the organization API to get all organization/instance name list from Azure DevOps

URL = https://dev.azure.com/instance_name/_apis/projects?api-version=5.1

And always getting the same response:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en-US">
    <head>
        <title>

            Azure DevOps Services | Sign In

</title>

Whenever I am calling the API even with fresh auth_token always getting the above error on Postman. Please help if anybody knows the answer.

1
Could you be more specific about what you want to retrieve by "get All instance name"?Ferdinand Fejskid
@FerdinandFejskid get All instance name means the organization that I have in my Azure DevOps account.Nayan Dubey
Hi @Nayan Dubey Was below answer helpful to you, Please let me know how was this case going?Levi Lu-MSFT

1 Answers

0
votes

According to the authentication flow describe here. Your calling to above api to get the access_token is only the first part to make api call to your Microsoft resources. When you get the access_token, you need to make another api call to azure devops services api using this access_token.

To get the account information of your azure devops account. You might need to call below azure devops rest api

GET https://app.vssps.visualstudio.com/_apis/accounts?api-version=5.1

I'm not sure if you called the right api to get the access_token to azure devops services.

Azure devops has its own authentication flow to authorize access to get Azure devops api. Please check here for details about how to get a access_token for azure devops and how to use the access_token to make call to azure devops rest api.

Update:

To authenticate calling restful api in postman. You can try choose basic auth for the authentication Type in post man, and the password is your Person access token. You donot need to enter your username.

enter image description here