Good day friends,
I have a problem since I am trying to make a post call to an api and the api does not receive my data if I do not string my data.
The problem is that when converting my data into a string I do not receive the correct characters in the backend of the apis. I need to use emojis and the call works perfect from POSTMAN but when doing it from axios, trying to send the data the backend does not recognize my data. And if I try to do it through the string, it doesn't recognize the emojis.
let data = {
username: config.API_USER,
password: config.API_PASS,
uploaded1: uploaded1,
uploaded2: uploaded2,
uploaded3: uploaded3,
uploaded4: uploaded4,
uploaded5: uploaded5,
audio: audio,
video: video,
mobile_no: numbers,
message: mensaje
};
// Using this makes API recognize data but not recognizing characters
// data = qs.stringify(data) + "&message=" + mensaje;
// if i use here console.log(data) it shows the message correctly showing emoji
// but api dont recognize special character.
//BUT: Postman post call works perfectly, backend recognize emoji
const instance = axios.create({
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
},
data: data
});
instance
.post(`http://XXXXXXX`)
I have tried to replicate the call made by postman but I don't succeed, the backend does not recognize my data.