Hi,
I followed this DOC (Corvid: Exposing a Site API with HTTP Functions | Help Center | Wix.com) to call my database items.
But I'm getting this error don't know what's wrong
{"error":{"name":"Error","errorGroup":"User","code":"WD_PERMISSION_DENIED","level":"warn"}}
Here is my code -
import {ok, notFound, serverError} from 'wix-http-functions'; import wixData from 'wix-data'; export function get_api(request) { // URL looks like: https://www.mysite.com/_functions/myFunction/John/Doe let options = { "headers": { "Content-Type": "application/json" } }; // query a collection to find matching items return wixData.query("Leads") .eq("title", request.path[0]) .eq("contactNumber", request.path[1]) .find() .then( (results) => { // matching items were found if(results.items.length > 0) { options.body = { "items": results.items }; return ok(options); } // no matching items found options.body = { "error": `'${request.path[0]} ${request.path[1]}' was not found` }; return notFound(options); } ) // something went wrong .catch( (error) => { options.body = { "error": error }; return serverError(options); } ); }
And here is my collection (Leads) screenshot -

Basically, I want to get For, FullName & Contact Number