Cannot hit API when using primary domain

oirsoy
Visitor
2 0 0

I want to ask about shopify API. I have an issue, here the details:
- When i hit API using Primary Domain, process of rest/graphql API is not working (let say url is: https://exampledummy.myshopify.com/admin/api/2023-07/graphql.json)
- But, when i hit api using Alias Domain, its work (let say url is: https://1234a-1.myshopify.com/admin/api/2023-07/graphql.json )

How i can use my primary domain to hit api shopify?

Replies 3 (3)

SBD_
Shopify Staff
1829 269 406

Hey @oirsoy 

 

Can you DM me store details please?

Scott | Developer Advocate @ Shopify 

oirsoy
Visitor
2 0 0

How do i DM you? i cant find message feature

ShopifyDevSup
Shopify Staff
1312 215 454

Hey @oirsoy,

 

The shop's primaryDomain can be set to the store's original myshopify.com URL, a custom domain, or a replacement myshopify.com URL. 

 

The Admin API requests should be made to the shop's myshopifyDomain, from when the store was created, which may or may not be the same myshopify.com URL as what the Online Store sales channel is using based on the store's settings. 

 

A query like this on whichever endpoint is working should confirm the store's settings:

 

{
 shop{
   id
   myshopifyDomain
   primaryDomain{
     host
     url
   }
 }
}

 

Hope that helps!

- James

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