POST method with GraphQL is failing with 404 error

POST method with GraphQL is failing with 404 error

Mohan1984
Visitor
1 0 0

am trying to communicate with POST method which is working fine in POSTMAN but not in SAP

https://[removed]@homestyles.myshopify.com/admin/api/2023-01/graphql.json

Replies 5 (5)

ShopifyDevSup
Shopify Staff
1453 238 508

Hey @Mohan1984 - I edited your post to remove your authentication credentials here as they could be used to create authentication tokens which would allow anyone to access the Shopify Shop in your link. In terms of the POST method, could you share the error message you're seeing as well as the payload body of your API call? If you're able to share an X-Request-ID from the Shopify response headers, that would be helpful as well, as it would allow us to pull some logs and look into this with you a bit further. 

Hope to hear from you soon - thanks! 

Al | Shopify Developer Support

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

asifmushtaq
Shopify Partner
3 0 0

Hi, I have the same problem and the details you are asked is below.

 

x-request-id: 5c08420b-da70-49f2-9175-0350f6374c9d

body: 
{

"query": "{shop{name}}"
}

 

ShopifyDevSup
Shopify Staff
1453 238 508

Hey @asifmushtaq

Thanks for sharing details. We were able to locate logs on our end, which appear to show the request being sent from Postman, as a GET request. The Shopify GraphQL endpoint (docs here) only accepts the POST request method, regardless of whether a query or mutation is passed. I wasn't able to replicate in testing, but can share a few troubleshooting tips and next steps to follow:
 

  • Ensure the request method is set to POST, then hit Save in Postman.
  • Ensure cookies are cleared, and the {shop}.myshopify.com URL is valid.
  • Ensure you are passing a body formatted as GraphQL data in the request body tab : { shop { name } }
  • Enable 'Follow original HTTP Method' setting in Postman, to avoid defaulting to GET in the case of redirects (switch setting on, see screenshot)


     
  • Resend the request.
  • If you are using an Admin created custom app, consider passing the access token as a key:value pair via a request header: Key: X-Shopify-Access-Token Value: {token}
     

If the unexpected behavior continues, make note of the date and x-request-id response header values for the request, and connect with Shopify Support (click here) directly so someone can take another look. 

Hope that helps - Cheers!
Shopify Developer Support 

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

asifmushtaq
Shopify Partner
3 0 0

Hi, for me the issue was with the URL of the shopify, 

I tried now with the unique url provided from the shopify. 73sna.myshopify.com instead of my own custom url.

ShopifyDevSup
Shopify Staff
1453 238 508

Hey @asifmushtaq,

Thanks for the quick reply. Glad hear you figured it out and aren't see this behavior anymore. 

Cheers!
Shopify Developer Support 

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