Hi,
I’m trying to upload xlsx files to API using POST request. Here my code
let fileContent = open("./files.xlsx");
// Authorization
export function setup() {
return {
token: getToken(),
};
}
export default function (config) {
const params = {
headers: {
Authorization: `Bearer ${config.token}`,
"Content-Type": "application/octet-stream",
},
};
let url =
baseUrl +
"bsp-ins-ref/api/standard-element-referential/vehicle-range/92eca041-a1eb-4e3f-8996-40f8267f52be/initialize-referential";
var res = http.post(url, fileContent, params);
check(res, {
"Upload Excel 200": (res) => res.status === 200,
});
}
Unfortunatly it doesn’t work, i have this error “Cannot deserialize the current JSON object”. I have the same issue with postman.
Thanks you in advice for your help.