After looked how it works, why I was getting this error... I'm asking to you to tell me if I'm wrong.
I'm using my API to create Task and Bug from user's feedback form.
public async createJIRAIssue(payload: any): Promise<any> {
const authToken = Buffer
.from('my@email.com:my-token')
.toString('base64');
try {
const result = await axios.post('https://my-instance.atlassian.net/rest/api/3/issue', {
"fields": {
"project":
{
"key": "KY"
},
"summary": "REST ye merry gentlemen.",
"description": "Creating of an issue using project keys and issue type names using the REST API",
"issuetype": {
"name": "Bug"
}
}
});
return result;
} catch (e) {
logger.error('Error at FeedbackService/createFeedback: %s', JSON.stringify(e));
throw handleError(e, 2020);
}
}
I got Error: Request failed with status code 400