Get all language and alternate versions of a specific field in published Stories via 1 GraphQL API call

Hello,

Is it possible to get all the language and/or alternate values (values of Stories that are linked as alternates) of a specific field in a Story or Stories that are Published?

Some context:
The data would be used for populating Hreflang tags on a page or in a sitemap. Instead of the Slug, a different field is used (e.g. a field called ‘URL key’).

Hello @SB-plus-e-com,

unfortunately, you will need to make at least a second call for getting the alternatives. You could use the by_slugs parameter for getting all alternatives after you’ve got the first story of the group and then take the full slugs from the alternatives array.

I need to check with my colleagues if there is a way to get the different translations of stories that are using the field level translation feature because the starts_with parameter allows only getting stories in one language in one request and then you would need to go through all languages one by one for getting them all.

I will write you when I discussed your use-case with my colleagues.

Best regards
Hannes

Hello @SB-plus-e-com,

I’ve checked the possibilities that you have regarding field-level translations and your use-case with my colleagues.
With a call to the me endpoint https://api.storyblok.com/v1/cdn/spaces/me?token=your_access_token ( Storyblok API Documentation ) you will get an object that contains the language_codes array which contains all languages that have been added in the Languages tab in your space. With those lang codes you’re able to get all necessary stories using the starts_with parameter and the language codes like starts_with=de/ .

Using the GraphQL API you can also get the language codes with the request:

{
  Space {
    languageCodes
  }
}

Best regards
Hannes