I think I’m overlooking something really basic here. I have an active authentication session and I want to get the current store information to access details like the email, store owner name, and other properties.
I’ve been trying to call /admin/shop.json endpoint and also attempted:
ShopifyAPI::Store.current
But that doesn’t seem to work either. What’s the correct way to retrieve the store object once I have proper authentication? I need to access the store details similar to what’s shown in the shop API documentation. Any help would be appreciated!
Sounds like your API client setup is the problem, not the endpoint. I ran into this same thing with Shopify’s API - you need to set the session context first before making any calls. Make sure you’re calling ShopifyAPI::Context.activate_session with your session object before trying to get shop data. Without this, the API client doesn’t know which store to use even if your auth is good. Also check your base URL format - some setups need the full shop domain with .myshopify.com when you initialize the session.
Had the same authentication headaches with Shopify’s API last year. Your session config is probably the culprit, not the endpoint. Double-check you’re initializing the ShopifyAPI session with the right shop domain and access token before making calls. ShopifyAPI::Session.setup with proper parameters fixed it for me. Also verify your app’s actually installed on the store - API calls can fail silently if the installation didn’t complete. Run a simple test call first to confirm your connection works before grabbing store details.
Your endpoint’s right, but you need /admin/api/2023-10/shop.json - don’t forget the API version in the path. I hit this same issue months ago and was missing the version spec. For Ruby, use ShopifyAPI::Shop.current instead of ShopifyAPI::Store.current - made that mistake too. The Shop resource has everything you need: email, shop_owner, domain, and other properties. Also check your auth token has read_content scope since some store info needs specific permissions.
check your access token first. if it’s expired or the headers r wrong, that’ll cause problems. i’ve been there too. try logging your auth details before hitting the api - it’ll help you spot what’s broken. good luck!