Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error 500 when i use "site" params in defaults configurations #195

Closed
scoch5 opened this issue Dec 2, 2024 · 2 comments
Closed

Error 500 when i use "site" params in defaults configurations #195

scoch5 opened this issue Dec 2, 2024 · 2 comments
Labels

Comments

@scoch5
Copy link

scoch5 commented Dec 2, 2024

Description

When I add a "site" key in "defaults" configurations I get a 500 error: "Error resolving Element API endpoint: Setting unknown property: craft\elementapi\resources\ElementResource::site".
I expect to be able to use the site param.

Steps to reproduce

  1. Use "site" key in default configurations

Additional info

  • Craft version: 5.5.4
  • PHP version: 8.2.18
  • Database driver & version: MySQL 8.0.33
  • Plugins & versions: 4.1.0
@scoch5 scoch5 added the bug label Dec 2, 2024
@jamesmacwhite
Copy link

Not supported currently, but a pending PR, suggests that site/siteId support may be added in a future release for endpoints.

craftcms/cms#16367

brandonkelly added a commit that referenced this issue Jan 20, 2025
@brandonkelly
Copy link
Member

Endpoint configs don’t support a site param, so that’s why you’re getting that error.

I just tagged Element API 4.2.0 which makes it possible to set a site criteria param within defaults, though:

return [
    'endpoints' => [
        // ...
    ],
    'defaults' => [
        'criteria' => [
            'site' => 'mySiteHandle',
        ],
    ],
];

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants