Skip to content

Get REST API collection entry based on slug? #10740

Answered by duncanmcclean
benebene84 asked this question in Q&A
Discussion options

You must be logged in to vote

Is there a way to set the id to the slug or request entries based on the slug? Or do I have to get all entries and then filter?

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:

/api/collections/articles/entries?filter[slug:is]=awesome
'collections' => [
    'articles' => [
        'allowed_filters' => ['title', 'slug'],
    ],
],

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@benebene84
Comment options

Answer selected by benebene84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants