1
Goodnight.
I’m trying to replicate an API call that I make in Postman in Windows of my Vue.js application.
In Postman I pass a token and in my JSON call body I pass the following simple array to download an xlsx file.
url: http://10.100.100.165:9999/download/arquivo/nome.xlsx
body: [1000,9645,32,1023]
This in Postman works normally, but I can’t replicate in Xios.
It either disregards my headers or disregards my message body. This array is also not part of an object, it’s just the array by itself.
download({dispatch,commit, state}, payload){
const token = Cookies.get("token");
let array = [];
payload.forEach(element => {
array.push(element.id)
});
axios
.get("/download/arquivo/nome.xlsx",
array,
{
headers: { Authorization: `Bearer ${token}` }
}
)
.then(res => {
this.forceFileDownload(res);
})
.catch(error => {
dispatch('apiErrorsHandler', error);
});
},
See if this works: https://gist.github.com/javilobo8/097c30a233786be52070986d8cdb1743
– Gleidson Henrique
where I pass the array with my information on that call?
– Otorrinolaringologista -man
GET does not send data, only other verbs (POST, PUT). GET sends parameters in the url. I advise you to search for the HTTP verbs and how they work.
– Gleidson Henrique
thanks for the help.
– Otorrinolaringologista -man