craftcms / element-api

Create a JSON API/Feed for your elements in Craft.
MIT License
498 stars 56 forks source link

Can't access disabled entries #104

Closed diluno closed 5 years ago

diluno commented 5 years ago

I'm having some trouble accessing disabled entries. I have two sites (DE and FR), and call the API by their respective site-URL. (/api/entries or /fr/api/entries). I would like to get the entries for each site whether they're disabled or not.

I tried the following critierias, and always got a 404:

'criteria' => ['enabledForSite' => false, 'slug' => $slug] 'criteria' => ['anyStatus' => true, 'slug' => $slug] 'criteria' => ['status' => ['disabled', 'live'], 'slug' => $slug]

elodiegrondin commented 5 years ago

Hi @diluno Did you find any solution for this ?

diluno commented 5 years ago

No, unfortunately I didn't.

ryanpcmcquen commented 5 years ago

@diluno, where did you get that list of status types? If I combine that with 'draftId' => $draftId, then I can get a disabled entry. But I want to make sure I'm not missing any status types.

diluno commented 5 years ago

I tried getting all entries, with status "disabled" or "live". I think getting one specific disabled entry works (with 'draftId'), but I can't seem to get multiple.

ryanpcmcquen commented 5 years ago

@diluno, are there other statuses besides 'disabled' and 'live'?

diluno commented 5 years ago

@diluno, are there other statuses besides 'disabled' and 'live'?

@ryanpcmcquen Yes, there are the following statuses: 'live', 'pending', 'expired', 'disabled'

ryanpcmcquen commented 5 years ago

@diluno, where are these documented?

diluno commented 5 years ago

Here: https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#status

olivierbon commented 5 years ago

Wether entries are 'live', 'pending', 'expired' or 'disabled', adding 'status' => null combined with 'enabledForSite' => false to your criteria will: