Hello,
I’m sending a media via Postman and it’s not working.
this is my axios request to the api
const add = async (data) => {
const config = {
headers: {
Authorization: `Bearer ${data.token}`,
},
};
const date = moment(data.data.expires).format("Y-mm-dd HH:mm:ss");
const formData = new FormData();
formData.append("file", data.data.file);
formData.append("name", data.data.name);
formData.append("expires", date);
formData.append("folder", data.data.folder);
formData.append("tag", data.data.tag);
console.log(formData);
const response = await axios.post(xibo_url + "/addMedia", formData, config);
return response;
};
Postman response
{
"files": [
{
"name": "1662431451-1203",
"size": 2,
"type": "application/json",
"url": "/api/library?file=1662431451-1203&download=1",
"width": null,
"height": null,
"mediaId": 94,
"storedas": 94,
"duration": 10,
"retired": 0,
"fileSize": 2,
"md5": "99914b932bd37a50b983c5e7c90ae93b",
"enableStat": "Inherit",
"mediaType": "image",
"fileName": "1662431451-1203",
"delete_url": "/api/library?file=1662431451-1203",
"delete_type": "DELETE"
}
]
}
I’m sending a form data with file, name, folder and tags.
can anyone help me?