Dylan
June 5, 2025, 5:08pm
1
Hi there,
The direct API access is a wonderful feature.
However, I’ve found that is doesn’t automatically use the latest version of the Admin API.
This forces you to pin a specific version in the URI:
fetch("shopify:admin/api/2025-04/graphql.json")
But this introduces some complications of tracking versions across multiple frontend components.
It would be really nice if we could just use latest
to refer to the latest version:
shopify:admin/api/latest/graphql.json
Additionally, the Direct API Access documentation doesn’t mention the default behavior if you don’t specify a version.
Which version is used by default?
When will it be updated during the API version lifecycle?
I dont think its safe to default to latest, because if there is an breaking API change, your implimentation will break its always good to fix a version.
Dylan
June 5, 2025, 6:21pm
3
I agree.
That’s why I’m suggesting developers can opt into latest
as an option.
Maybe even a stable
as the oldest supported stable option.
If you do not pass a version now, I have no idea what the current version progression is. I just know it’s before themes
on QueryRoot is supported.
Leave the version out of the URL and it will use the API version defined in your TOML latest:
fetch("shopify:admin/api/graphql.json")
Note that we’re working on switching this to instead use the API version defined in your TOML (that’s what happens today in UI Extensions), but currently for App Bridge it’s latest.
Dylan
June 5, 2025, 6:55pm
5
Note that we’re working on switching this to instead use the API version defined in your TOML (that’s what happens today in UI Extensions)
That makes a lot of sense! I think is is the most intuitive way to handle this versioning.
but currently for App Bridge it’s latest.
Unfortunately I’m not seeing that to be the case.
For example, by default the themes
object isn’t accessible in the QueryRoot unless I define a > 2024-10 version explicitly.
Here’s my example query:
fetch("shopify:admin/api/graphql.json", {
method: "POST",
body: JSON.stringify({
query: `
query {
themes(first: 1, roles: MAIN) {
edges {
node {
name
id
role
files(filenames: ["templates/product.json"]) {
nodes {
filename
body {
... on OnlineStoreThemeFileBodyText {
content
}
}
}
}
}
}
}
}
`,
}),
})
.then((res) => res.json())
.then((data) => {
console.log(data);
})
.catch((err) => {
console.error(err);
});