Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

REST API - "Not Found" When Retrieving Globals by Handle in Multisite Setup #10636

Open
toxsick opened this issue Aug 15, 2024 · 0 comments
Open

Comments

@toxsick
Copy link

toxsick commented Aug 15, 2024

Bug description

In a Statamic multisite setup, attempting to retrieve globals by handle using the REST API with and without specifying the site using the ?site=site_handle query parameter results in a {"message": "Not found."} error. This issue occurs when the global does not belong to the first site in the configuration, making it inaccessible via the API for other sites.

Notably, the issue is resolved immediately if the global is added to the first site in the multisite configuration. Once the global is associated with the first site, it becomes accessible via the API.

How to reproduce

  1. Set up a multisite environment in Statamic with two sites and enable the content rest api.
  2. Create global and configure it to belong to the second site
  3. Attempt to retrieve the global variable via the REST API using the endpoint /api/globals/{handle} returns {"message": "Not found."}
  4. Attempt to retrieve the global variable via the REST API using the endpoint /api/globals/{handle}?site=site_handle returns {"message": "Not found."}
  5. Add the global to the first site in the multisite configuration OR reorder sites so that the second site is the first site
  6. Retry retrieving the global via the API and the global is returned as expected.

I am doing the same thing with nav trees and there it works as expected.

Thanks for looking into this!

Logs

No response

Environment

Environment
Application Name: Statamic DEV
Laravel Version: 11.20.0
PHP Version: 8.3.9
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: localhost:3000
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: file
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 0
Sites: 2 (Site de, , Site en)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.21.0 PRO

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants