Get REST API collection entry based on slug? #10740
-
Hey everyone, I tried to search for similar issues, but didn't really find anything. I am trying to use Statamic as a headless cms and render the content in a Nextjs Frontend. However as far as I can see, it requires the id of the entry. And if i create a new page, the id is a randomly created. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As you've discovered, the "single entry" doesn't support getting entries with anything other than the entry ID. You need to get all the entries and filter by slug instead:
'collections' => [
'articles' => [
'allowed_filters' => ['title', 'slug'],
],
], |
Beta Was this translation helpful? Give feedback.
As you've discovered, the "single entry" doesn't support getting entries with anything other than the entry ID.
You need to get all the entries and filter by slug instead: