Getting Error 404: Not Found for shopify graphql API

salman116
Tourist
19 0 2

I am using django and making an app for shopify my app is published on shopify but not visible on its store. I can easily onboard any test store to my app and everything works smoothly . but recently I made a real store and tried to install my app from the shopify app store url but when it hit APP_SUBSCRIPTION_CREATE graphql API, it gives this error b'{"errors":"Not Found"}' HTTP Error 404: Not Found why is this happening

Here is the code for GraphQL API:

variables = {
    "name": obj.name,
    "returnUrl": f"https://{app_url}/shopify/return_url/",
    "test": obj.test,
    "lineItems": [
        {
            "plan": {
                "appUsagePricingDetails": {
                    "terms": obj.terms,
                    "cappedAmount": {
                        "amount": str(obj.capped_amount),
                        "currencyCode": "USD"
                    }
                }
            }
        }
    ]
}
import json

result = graphql_client.execute(APP_SUBSCRIPTION_CREATE, variables)


APP_SUBSCRIPTION_CREATE = """
mutation AppSubscriptionCreate($name: String!, $returnUrl: URL!, $test: Boolean, $lineItems: [AppSubscriptionLineItemInput!]!) {
  appSubscriptionCreate(name: $name, returnUrl: $returnUrl, test: $test, lineItems: $lineItems) {
    userErrors {
      field
      message
    }
    appSubscription {
      id
      lineItems {
        id
        plan {
          pricingDetails
          __typename
        }
      }
    }
    confirmationUrl
  }
}
"""

I am getting the error here
graphql_client.execute(APP_SUBSCRIPTION_CREATE, variables)

 

Reply 1 (1)

Liam
Shopify Staff
2731 299 769

Hi Salman116,

 

There's a few parts of the mutation that are not matching the example in the dev docs, specifically the variables input - which could be causing this error. It also looks like there could be a typo in the return URL property (an f at the beginning). I'd try to match the example as much as possible and try again.

 

Hope this helps,

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog