Hi All,
I'm a village idiot on API things so please bear with my stupid questions.
Here is my problem to solve: I have a JIra project and want to extract some data from my issues and inject them to an html page.
I looked up JIRA API docs and was not sure of how to use them properly (syntax wise).
I also tried out some APIs via CLI such as:
curl -D- -u nguyen7744@yahoo.com:<my password>GET -H "Content-Type: application/json" https://automationexpert.atlassian.net/rest/api/latest/myself
It works beautifully :-).
Now I want to create a Javascript program that will make similar API call to my Jira.
Here is how my sample JavaScript code (learned form youtube) looks like:
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var ourRequest = new XMLHttpRequest();
ourRequest.open('GET', 'https://learnwebcode.github.io/json-example/animals-1.json');
ourRequest.onload = function () {
"use strict";
console.log(ourRequest.responseText);
};
Question:
How can I replace the string 'https://learnwebcode.github.io/json-example/animals-1.json' with the string 'curl -D- -u nguyen7744@yahoo.com:<my password>GET -H "Content-Type: application/json" https://automationexpert.atlassian.net/rest/api/latest/myself'
In other words, I'd like to extract the "myself" data from my Jira with basic authentication.
What do I need to do? Thanks!