Hello everyone, I have some problem with the Jira API and the POST request on the website.
Here I am trying to do a POST request from my WordPress website with Basic Authorization
<button type="submit" onclick="postApi()">POST</button>
<script>
function postApi(){
fetch('MY_URL',{
mode: 'no-cors',
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa('MY_USERNAME' + ':' + 'MY_TOKEN'),
'Accept': 'application/json',
'Content-Type': 'application/json'
},
"data": JSON.stringify({
"fields": {
"project": {
"key":"ATS"
},
"summary": "Test applicant",
"description": "Hi and Hi",
"customfield_10034": "fname",
"customfield_10035": "lname",
"issuetype": {"name": "Task"}
}
})
})
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error))
}
</script>
The data put in there is just for me to test the API to work, no worries about that.
The problem is the console showing me that there is a 403 error which means that I have no permission to complete the action while it works on Postman ![]()
Does anyone know what the underlying problems are here?
Please let me know
Thanks so much and I’ll appreciate every reply ![]()