Hi, my app has read_themes acces. Based on this documentation shopify.dev/docs/api/admin-graphql/unstable/queries/themes?language=Remix&example=Get+first+theme you should be able to retrieve theme using graphql.
but when i query themes (simplies query from docs example) i am receiving error:
“message”: “Field ‘themes’ doesn’t exist on type ‘QueryRoot’”. That should not happen.
I also checked shopify.dev/graphiql/storefront-graphiql - there is no such query arg as themes, since then it is not found .
Yes. now kinda works on 2024-10 . There are 2 minor problems
this preview is not updated shopify.dev/graphiql/storefront-graphiql so it is missleading that themes doesnt work there but works in code
wen i retrieve the information (i have read themes accesss) i am getting full response with all arguments that i need BUT i am also getting error at the end but there is no errir in query.
So to start with, the files is not available directly in the themes query so you need two queries, one to grab the first 10 themes from your store. Then you store the response with the ID’s locally, then for each ID, you grab the files that you need with the query below:
query GetThemeFileContent {
theme(id: "gid://shopify/Theme/123456789") { # Replace with your theme ID
id
name
role
file(filename: "config/settings_data.json") {
body {
... on OnlineStoreThemeFileBodyText {
content
}
}
}
}
}
Shopify provides multiple APIs. The URL mentioned focuses on the Storefront API, but the request you are making goes against the Admin GraphQL API. Being different APIs for different audiences, they have different features.
I am facing the same error when using direct_api_mode and sending the query through fetch to shopify:admin/api/graphql.json.
It works correctly when I run this on the server, but using direct api mode in my embedded app returns Field 'themes' doesn't exist on type 'QueryRoot'
When using shopify:admin/api/graphql.json, it currently goes against the oldest supported API version (2024-01). This API version does not have the functionality you are looking to use. You can follow this workaround to specify the API version directly: