cms icon indicating copy to clipboard operation
cms copied to clipboard

[5.x] Support query scopes in REST API

Open ryanmitchell opened this issue 1 year ago • 1 comments

This PR adds support for using query scopes in the REST API.

The URL format follows the same approach as filters:

https://mysite.com/api/collections/pages/entries?query_scope[my_scope]=value

or, if you have multiple values

https://mysite.com/api/collections/pages/entries?query_scope[my_scope][value_key]=value&query_scope[my_scope][another_value_key]=value2

I've made a few changes to FilterAuthorizer to allow it to be easily extended by the new QueryScopeAuthorizer, seeing as they are basically doing the same thing with just a difference in the key being checked.

Closes https://github.com/statamic/cms/issues/3310

ryanmitchell avatar Oct 03 '24 06:10 ryanmitchell

Okay, now this gets interesting with Query Scopes in REST. Maybe we can finally ditch those custom controllers that do some custom filters 👀

lokmanm avatar Oct 03 '24 21:10 lokmanm