Skip to main content

Node JS

GET

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

POST

const response = await fetch('<YOUR ENDPOINT URL>', {
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
apiKey: '<YOURTOKEN>',
},
method: 'POST',
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 atlassianResponse = await response.text();
console.log('response', atlassianResponse);