Skip to main content

TypeScript

GET

const example = async () => {
const response = await fetch('<YOUR ENDPOINT URL>', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
apiKey: '<YOURTOKEN>',
},
body: JSON.stringify({
options: {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
},
url: '/rest/api/3/issue/DEV-16',
}),
});
const responseJira = await response.text();
console.log('response', JSON.stringify(JSON.parse(responseJira), null, 2));
};

example();

POST

const example = async () => {
const response = await fetch('<YOUR ENDPOINT URL>', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
apiKey: '<YOURTOKEN>',
},
body: JSON.stringify({
options: {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: {
fields: {
project: {
name: '<your project name>',
},
summary: 'Create Issue via POST.',
description: 'Creating of an issue via a POST request using the API Key Manager',
issuetype: {
id: '<your issue type id>',
},
},
},
},
url: '/rest/api/2/issue',
}),
});
const responseJira = await response.text();
console.log('response', JSON.stringify(JSON.parse(responseJira), null, 2));
};

example();