How to fetch a record from prismic repository by specifying required fields through API
for example :
[at(document.type,"product")]
fetch product.product_name
we have tried to fetch the details with below query and it is not working
How to fetch a record from prismic repository by specifying required fields through API
for example :
[at(document.type,"product")]
fetch product.product_name
we have tried to fetch the details with below query and it is not working
Hello @peter
Welcome to the Prismic community, and thanks for reaching out to us.
fetch
is a search parameter. You need to add a search parameter in the query URL. When Querying the API Browser, you need to add search parameters before the hashtag (#) in the URL to get filtered results.
For e.g., In your case, add a search parameter in the URL after querying the API browser like:
&fetch=bundle.bundle_name
Learn more about the Search parameter here.
Let me know if you have further questions related to it.
Thanks,
Priyanka
Hi Priyanka,
Thank you for the support.
In Postman we are able to get it. But in browser as below screen shot we are unable to get it.
Regards,
Peter
It should work in the API browser as well. After querying the API browser, you need to put search parameters in the query URL.
For instance:
&fetch=page.image
in the URL to fetch only an image field from the page.Now you change your-repo-name
with your repository name and add fetch
search parameter.
I hope it's clear now and if you have any further questions, please let me know.
Thanks,
Priyanka