TransWikia.com

Filter for language when using graphQL

Craft CMS Asked by Jeremy Benks on December 24, 2020

I try to use graphQL to get language specific entries from my Craft CMS. I (naively?) tried this:

query {
    entries (section: "newsIntranet", language: "fr") {
        title
        postDate
        expiryDate
        contentText
    }
}

because of this part of doc.
How can I get make sure that I only get entries of a given language when using graphQL from an extrernal system?

One Answer

You'll want to use siteId for this.

query {
    entries (section: "newsIntranet", siteId: "2") {
        title
        postDate
        expiryDate
        contentText
    }
}

Swap out "2" with whatever the siteId of the French site is on your system.

Correct answer by Brad Bell on December 24, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP