For intsance say I have a books type and then an author type…
when I use client.getEntries(); (JS) how do I search by only books?
For intsance say I have a books type and then an author type…
when I use client.getEntries(); (JS) how do I search by only books?
You can use the content_type
parameter. Docs are here: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/content-type
So where do specify the content_type URI?
is it client.getEntry(‘URI’) ?
client.getEntires(‘URI’) ?
The docs are sort of confusing
getEntry
only takes a single id and returns that item while getEntries
return multiple items and has many parameters to filter what you get back. If you want to get all items with the content_type id "book"
items you would do something like:
client.getEntries({
content_type: "book"
}).then(response => {
return response.items;
});