This request works fine from postman, but i am trying to replicate it from axios but i cannot
This is what i did (Note that i am getting the same response status, but the language is not being updated on the instance itself)
const config = { headers: {'Content-Type': 'application/json'} };
const lang ="en_US";
return axios.put("https://add-jira8.infosysta.com/rest/api/2/mypreferences?key=jira.user.locale", lang,config).catch(ex => {
console.log(ex)
ErrorLoging.log("AxiosRequests.js >>>>> updateUserLanguage >>>>>> ERROR: " + ex)
});
This is the api endpoint used
2
Answers
You have issue in your body even in your postman, you selected json so it should be a json, like:
Looking at the screenshot you provided the body is sent as "raw" but in your code you are trying to sent JSON. Not sure which one the server accepts but if it expects raw then you should change the content type: