How to expose different model fields in the frontend API? #24
-
The frontend api is a subset of options available on the backend. How can I choose which fields to expose to the frontend api such that when grabbing the products, I also get their categories, category_id, category_index, or other fields only found in the backend api? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Hi @ieatmangos, you can check that out in this guide: https://developers.swell.is/guides/opening-content-permissions |
Beta Was this translation helpful? Give feedback.
-
@rodrigoddalmeida that link is returning a 500 server error |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response! Im still trying to understand how this all works... "Making these permissions public will grant any user editing access to your store’s content models and fields." What if I wanted to read only, not write. Is there a way to accomplish this without opening up edit access to any user? Should I be using my pages/api folder (next.js) to run an instance of the backend, creating specific endpoints to call on the front end.. ie. a route called api/getAllProducts that is inclusive of their category (or whatever fields I want). Or if I should be making edits like you've said above and use swell.products.list({...}) in my web application? |
Beta Was this translation helpful? Give feedback.
-
If you want
|
Beta Was this translation helpful? Give feedback.
Hi @ieatmangos, you can check that out in this guide: https://developers.swell.is/guides/opening-content-permissions