I’m writing an embedded app and I need it to display a list of themes for the user. Once the user has selected a theme I then want to add some assets to that theme. I want to move away from REST to using GraphQL.
The endpoint for REST is…
/admin/api/2019-10/themes.json
Is this query possible using GraphQL? I can’t find a queryRoot that relates to themes or assets.
I took a quick look as well and I don’t believe themes or assets are accessible via API currently. Is there something you are trying to accomplish that can’t be done through REST so you were looking at GraphQL? Or just converting in general.
Edit: Oops, wrong thread. Seems I can’t delete my post. Anyway, since it may be vaguely related, I will just leave here what I wrote in case someone is looking for how to access theme section translations:
I think I finally found a way. Will be a bit more work to find the translations one needs, deciphering the ids for section content, but it seems that’s where one can find them.
query {
translatableResources(first: 10, resourceType: ONLINE_STORE_THEME) {
edges {
node {
resourceId
translatableContent {
key
value
digest
locale
}
translations(locale: "de") {
key
locale
market {
name
id
enabled
}
outdated
updatedAt
value
}
}
}
}
}
Edit 2: This will only retrieve translations for the live theme. For other themes use “translatableResourcesByIds” with the corresponding theme ids:
translatableResourcesByIds(first: 10, resourceIds: ["gid://shopify/OnlineStoreTheme/109876543210", "gid://shopify/OnlineStoreTheme/12345678910"]) {
...same fields as other query above
}
Currently the theme API’s are still only available in REST. If it helps, we have our documentation here on integrating your apps with the online store and themes and the various ways it can be achieved: https://shopify.dev/docs/apps/online-store