Query wix forum

How can I query wix forum frontend or backend. The normal back end code for wix inbuilt pages doesnt work for forum Forum/××× but works for Members/×××

https://www.wix.com/velo/reference/wix-forum-v2/introduction is in beta but has some new functions for querying the forum.

You can expose backend functions to the frontend using web methods but make sure to be careful with permissions depending on what you’re doing: Wix Studio: About Web Methods

This threw an error -

 let options={$and:[{_ownerId:{eq:iddedd}},{categoryId:{eq:"64e4a73ec2xxxxxxxxxxe8f2"}}]}
queryPosts(options) 
  async function queryPosts(options) {
   try {
     const result = await posts.queryPosts(options);
console.log("ALL THE FORUM POSTS LIST", result)
     return result;
   } catch (error) {
     console.error(error);
     // Handle the error
   }
 }

Can you share what the error was?

Error: message: Forbidden
details:
applicationError:
description: Forbidden
code: FORBIDDEN
data: {}
at No (index.js:29:17)
at index.js:79:16
at Co (index.js:125:20)
at Mo (transformation-handler.js:77:12)
at forum-v1-post.universal.js:348:38
at Generator.throw ()
at s (forum-v1-post.universal.js:5:64)

I see. According to the docs the queryPosts function needs elevated permissions to run.

Details on how to do this are here: elevate - Velo API Reference - Wix.com

Edit: You can expose queryPosts with Wix Studio: About Web Methods but do make sure to check who is querying before you return the posts if you don’t want everyone to be able to use this function.

So you cant query wix forum.