Trying to code PUT http function to update wix database from external database on the basis of the “_id” of the row.
Code is as below, but keep getting 500 error. Any suggestions?
export function put_updaterecords (request) {
return request.body.json()
.then(body => {
let recordUpdate = {
"_id": body.ID,
"title": body.Title,
"firstName": body.FirstName,
"lastName": body.LastName,
"color": body.Color,
"number": body.Number
};
return wixData.update("SampleCollection", recordUpdate)
.then(result => ok({body: JSON.stringify(result)}))
.catch(err => response({status: 500, body: err}));
})
}