A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello
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.
Many thanks
Paul
Solved! Go to the solution
This is an accepted solution.
Hi @clucs123,
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.
Ryan | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
This is an accepted solution.
Hi @clucs123,
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.
Ryan | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Hi Ryan
I'm just trying to use graphql whenever possible and couldn't find themes or assets anywhere in the schema.
I using the REST API now for the themes GET so it's not a problem.
Thanks for taking a look.
Paul
Hi! is there a way to access assets/themes using GraphQL?
Hi -
Looks like this thread is quiet, but is just what I'm looking for.
The /themes.json endpoint from REST API returns a graphQL id:
{
"id": 123456789,
"name": "Theme 4 Old",
"created_at": "2019-08-02T11:41:13-04:00",
"updated_at": "2020-03-23T14:54:10-04:00",
"role": "unpublished",
"theme_store_id": null,
"previewable": true,
"processing": false,
"admin_graphql_api_id": "gid://shopify/Theme/123456789"
}
I find it odd that this isn't actionable in GraphQL at all. Is this just default behavior for all REST endpoints, and preparation for the future?
It's been 3.5 years. Has anything changed? Maybe I'm missing it but I can't find the way to retrieve theme data via GraphQL.
I currently need to detect themeID and it looks like I'd have to utilize rest API just for this. This is surprisingly odd.
Hey @CafeDelMar ,
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
Cheers,
- Kyle G.
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
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
}