What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

graphql scriptTags

Solved

graphql scriptTags

garrettbryan
Shopify Partner
12 2 10

I'm trying to query my scripttags. This query works in the console:

https://example.myshopify.com/admin/apps/shopify-graphiql-app

query {
  scriptTags(first: 5 ){
    edges {
      node {
        id
        src
        displayScope
      }
    }
  }
}
 
But it doesn't work in my app. I've checked with other queries, they are successful. The following scopes are applied:
scopes: [
'read_products',
'write_products',
'read_customers',
'write_customers',
'read_script_tags',
'write_script_tags'
],
 
Any idea what is happening?
Accepted Solution (1)
garrettbryan
Shopify Partner
12 2 10

This is an accepted solution.

Figured it out! Sometimes it pays to read all of the docs!

https://help.shopify.com/en/api/reference/online-store/scripttag#index

 

Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.

 

I was expecting to see the scripttags added by another app in my query.

View solution in original post

Replies 4 (4)

JeremyDevmore
Shopify Partner
10 0 2

Tried uninstalling/reinstalling?

garrettbryan
Shopify Partner
12 2 10

Thanks for the response. I did reinstall the app and restart the server.

 

Below is the result. I also added added read_theme and write_theme to the access scopes. No luck.

 

{
  "shop": {
    "name": "example",
    "primaryDomain": {
      "url": "https://example.myshopify.com",
      "host": "example.myshopify.com",
      "__typename": "Domain"
    },
    "__typename": "Shop"
  },
  "scriptTags": {
    "edges": [],
    "__typename": "ScriptTagConnection"
  }
}

I'm going to try enabling all access scopes temporarily.

garrettbryan
Shopify Partner
12 2 10

This is an accepted solution.

Figured it out! Sometimes it pays to read all of the docs!

https://help.shopify.com/en/api/reference/online-store/scripttag#index

 

Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.

 

I was expecting to see the scripttags added by another app in my query.

Not applicable

@garrettbryan  i hope you can help me on it, I  try with graphql pay ground but still not output.

using the API i can see the successfully request is done.  
here is my question https://community.shopify.com/c/shopify-apis-and-sdks/how-to-create-script-tag-use-of-graphql/td-p/1...