Here is the code:
async createTemplate({ commit }, data) {
console.log("CREATE TEMPLATE data STORE.JS: " + JSON.stringify(data));
return await API.put(
"asulink",
"/scheduler/schedule",
{
"schedule_name": "MJ Test 3",
"public": "true",
"local_times": [
1200,1230,1300,1330,1400,1430
]
}
).then((response) => {
console.log("API.PUT ADD A SCHEDULE"+JSON.stringify(response))
})
.catch((err) => {
window.console.log("Error occured", err);
});
},
If I make this API call I get a 400 error. The error says: Please send a valid JSON body.
But if I copy the above JSON body and make the same PUT API call using OpenAPI I get a 200.
I am not sure whats going on.
And this is not an axios call, but a Amplify API.put call.
question from:
https://stackoverflow.com/questions/65887643/am-i-doing-something-wrong-in-this-api-call 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…