Like what we’re doing? Star us on GitHub!

Any way to get *non* localized data from the REST API.

richardvanbergen
last year
1 1

Hey guys,

I have a bunch of localized fields but there's one particular query where I need to get all available translations. The page slug. The reason being is I need to provide alternate language URLs and allow the user to switch between languages and each document can have multiple languages with independent URLs.

Currently the only way I can see to do that is loop over all available locales and query for each document of that locale to find out if it exists.

Is there any way for me to do that directly via the API? I couldn't see anything in the docs.

  • jmikrut
    Payload Team
    last year

    Hey @richardvanbergen

    We do have a way to do this!

    ?locale=*

    Somehow that went un-documented. It only works via the REST API for now, because of GraphQL's strongly typed nature. Enabling this in GraphQL would mean that we have to make a whole other set of queries, which is possible, but likely lower on our priorities list.

    We will get our docs updated ASAP. Give it a shot!

    1 reply
  • richardvanbergen
    last year

    Thanks! It works quite nicely. 🙏

Open the post
Continue the discussion in GitHub
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More