2

I am currently trying to make a GET call to Azure DevOps Rest API using JavaScript however, I am having a hard time doing so. How will I be able to accomplish this?

This is what I have for the uri.

uri: https://dev.azure.com/<team project>/_apis/projects?api-version=2019-12-01
1
  • 1
    You should put some code out here to show what you've tried and what went wrong. Commented May 22, 2020 at 14:56

1 Answer 1

2

Please take a look here. You have there an example.

But if you want to use pure vanila here you have sth:

var request = new XMLHttpRequest()

request.open('GET', 'https://dev.azure.com/thecodemanual/_apis/projects?api-version=5.1', true)
request.setRequestHeader('Content-Type', 'application/json; charset=utf-8;');
request.setRequestHeader ("Authorization", "Basic " + btoa('Basic' + ":" + 'YOUR_PAT_TOKEN'));

request.onload = function() {
  // Begin accessing JSON data here

  var data = JSON.parse(this.response)

  if (request.status >= 200 && request.status < 400) {
    console.log(data)
  } else {
    console.log('error')
  }
}

request.send()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.