I am working on REST API.
From my end, everything seems to be fine. I've tried multiple libraries (AXIOS, request, fetch) in order to make a PUT call.
However, I keep on getting 429
or 400
as a response code.
Below is the implemented code
const fetch = require('node-fetch');
const date= new Date();
const bodyData = `{"fields":
{
"priority":{"name":"Blocker"},
"date":"${date}"
}
}`;
await fetch('url', {
method: 'PUT',
headers: {
'Authorization': `Basic ${Buffer.from('username:password').toString('base64')}`,
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: bodyData
})
.then((response) => { console.log(response.data) }) //print the result
.catch((err) => {return res.json({'msg': "Something went wrong"})});
Observation:-
- The 429 error should not appear if the structure of the fetch call is incorrect.
I am not sure If am missing something, could you guys help me please?