State of GraphQL Admin Api

Alexander_Karma
Shopify Partner
4 0 1

Hi all,

I noticed that GraphQL admin api is very unstable and certain things are simply not possible. For example, if try to create a webhook with topic PRODUCTS_CREATE it works fine but ORDERS_CREATE doesn't although with the same set of access scopes I CAN do so via REST api.

Now I know it is in Beta but that usually implies that most of the functionality is there and I don't understand why those webhook registrations would fail.

Anybody has thoughts on that?

Is it too early to develop with GraphQL admin api?

Replies 18 (18)
Alex
Shopify Staff
1555 81 310

You're going to have to be more clear about what you mean when you say unstable, to address your first statement.

Regarding ORDERS_CREATE webhooks: I seem to be able to create these just fine. Can you provide more information? What does your query look like, what scopes do you have exactly, etc.

Cheers.

Alex | 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

Alexander_Karma
Shopify Partner
4 0 1

Hi Alex!

Sure, here's what I'm doing (very basic stuff taken directly (almost) from examples on shopify website).

Access scopes I have:

['read_products', 'write_products', 'read_themes', 'write_themes', 'read_checkouts', 'read_orders']

Mutation:

mutation webhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: WebhookSubscriptionInput!) {
  webhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {
    userErrors {
      field
      message
    }
    webhookSubscription {
      id
    }
  }
}

Variables for mutation:

{
            "topic": "ORDERS_CREATE",
            "webhookSubscription": {
                "callbackUrl": `<myHost>/webhooks/order-created`
            }
        }

Response I get:

"webhookSubscriptionCreate": {
        "userErrors": [
          {
            "field": [
              "webhookSubscription"
            ],
            "message": "You cannot create a webhook subscription with the specified topic",
            "__typename": "UserError"
          }
        ],
        "webhookSubscription": null,
        "__typename": "WebhookSubscriptionCreatePayload"
      }

As I mentioned earlied, PRODUCTS_CREATE works fine with that setup and switching to REST api works for both topics just fine.

Alex
Shopify Staff
1555 81 310

Thanks so much for the details! There definitely appears to be an inconsistency here. I'll raise this issue with the platform developers and I'll let you know what direction we're going to take. In my opinion, read_orders should be all you need.

Cheers and stay tuned.

Alex | 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

Alex
Shopify Staff
1555 81 310

Just stopping by to confirm we have determined this to be an issue and are investigating. When a fix rolls out I'll let you know. In the mean time, write_orders will get you the permissions you need if you need to use GraphQL, or a REST call with read_orders will work too (for any others joining the conversation).

Cheers.

Alex | 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

Alexander_Karma
Shopify Partner
4 0 1

Ok, sounds good!

Thank you for looking into this so quickly!

jstaab
Excursionist
16 1 7

I'd just like to point out that this is still an issue and tripped me up. It would be nice to at least have the bug documented somewhere. In fact, I was looking for a place where scopes are mapped to webhook topics and couldn't find one, which would also be helpful.

itsalexhsu
Shopify Partner
3 0 0

Just came here to say that I also encountered this issue. Workaround described fixed it. But please keep us updated when a fix is released since I don't want to ask for more permissions than I have to.

subbu
Shopify Partner
4 0 0

I too have exact same issue . I do have read_order permission but can't create grpahql webhook for 'ORDERS_CREATE'. 

filosganga
Shopify Partner
6 0 2

This issue is still present for `CUSTOMER_CREATE` and `CUSTOMER_UPDATE` topic. You need the `write_customers` permission to be able to register a webhook. It does not make any sense, `read_customers` should be enough.