Hi all,
I’m trying to update a few fields in a collection on my website through a HTTP Put request (
PUT /web-ld/_functions/loadLightLevels HTTP/1.1
Host: peterleiboldvi.wixsite.com
Content-Type: application/json
Content-Length: 15
{
"1G" :10
}
but I’m receiving “WD_DATA_VALIDATION” error:
{
"error": {
"name": "Error",
"errorGroup": "User",
"code": "WD_VALIDATION_ERROR"
}
}
The code in the backend of my site to receive this is:
export function put_loadLightLevels(request) {
let options = {
"suppressAuth": true,
"suppressHooks": true,
"headers": {
"Content-Type": "application/json"
}
};
// get the request body
return request.body.json()
.then( (body) => {
// update the item in a collection
return wixData.update("LightLevels", body);
} )
.then( (results) => {
options.body = {
"inserted": results
};
return ok(options);
} )
// something went wrong
.catch( (error) => {
options.body = {
"error": error
};
return serverError(options);
} );
}
Do I need to attach some sort of token?
It occurs to me that it might be not knowing where the resource should be going, but I’m not sure how to define that.
Any thoughts to share? I’m still new to some of this, so don’t be afraid to talk to me like I don’t know what’s going on.
Thanks so much!