Inserting Data to Wix via JSON/REST API: WD_PERMISSION_DENIED

I’m trying to insert data to my Wix collection using the API. I’m using a POST function and am posting a JSON document. It’s supposed to simply add a new row to a database containing 1 value.
Here is the http-functions.js which I can trigger without issues (it’s more or less a copy of the example from the documentation):

import {created, serverError} from 'wix-http-functions';
import wixData from 'wix-data';

export function post_peopleCount(request) {
  let options = {
    "headers": {
      "Content-Type": "application/json"
    }
  };
  // get the request body
  return request.body.text()
    .then( (body) => {
      // insert the item in a collection
      return wixData.insert("NumberOfPeopleDB", JSON.parse(body));
    } )
    .then( (results) => {
      options.body = {
        "inserted": results
      };
      return created(options);
    } )
    // something went wrong
    .catch( (error) => {
      options.body = {
        "error": error
      };
      return serverError(options);
    } );
}

The database looks like this:

and the JSON I am posting looks like this:

But the Error I am getting is:

But the permissions I have set for the collection is:

Do you know why I might be getting that “WD_PERMISSION_DENIED” and 500 Server Error? (The data does not get entered.)

Thanks!

I have been asked about the Authorisation parameter. I am not using any in Postman and still get the same error:

Also the Wix site event logs seem to remain empty: https://www.wix.com/dashboard/xxxxxx/settings/monitoring/site-events

I have also tried the suppressAuth parameter set to true but that didn’t help either.

By the way, I managed to solve it. I don’t know what the problem was, but re-creating the collection from scratch, giving it a different name and giving the column called “value” a different name fixed it for me. Maybe the name “value” is a reserved name? Or there was another glitch?

Anyways, if you run into issues, try re-creating the collection.

Looking over your original post, the only thing I can see is that the field in the object is Value , but the collection field key would be value . Keep in mind that the field key is used for Corvid database actions - not the field name .