Focuses on API authentication, access scopes, and permission management.
This question might have been asked before, but I'm finding it difficult to glue the pieces of information together in the shopify docs.
I'm building a marketplace for businesses, and was hoping to allow my sellers to connect their Shopify stores / upload their products to my marketplace. I'm not looking to build an app inside of Shopify. From the document that I've been reading, it's all referring to building an app inside of Shopify.
Is it possible to access store information and seller product information via API to an external marketplace app?
Hi Glai,
To send store information and seller product information via API you would need to create a custom app, where you'll be able to get API keys and access to making queries that you'd require.
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
Hey there Glai! I know this post is older, so you very well may have found a solution to this inquiry. In my experience, to access data from a specific instance within Shopify, please find Python / Flask example below for reference:
@Anonymous_bp.route('/')
def index():
return render_template('index.html')
@products_bp.route('/products', methods=['GET'])
def get_all_products():
# Define the URL for the REST API request
url = f'https://{SHOP_NAME}.myshopify.com/admin/api/{ADMIN_API_VERSION}/products.json'
# Headers for the REST API request
headers = {
'Content-Type': 'application/json',
'X-Shopify-Access-Token': ADMIN_API_ACCESS_TOKEN
}
# Make the REST API request
response = requests.get(url, headers=headers)
# Check if the request was successful
if response.status_code == 200:
return jsonify(response.json())
else:
return jsonify({'error': 'Unable to fetch products'}), response.status_code
@products_bp.route('/products/<product_id>', methods=['GET'])
def get_product_by_id(product_id):
try:
# Define the URL for the REST API request
url = f'https://{SHOP_NAME}.myshopify.com/admin/api/{ADMIN_API_VERSION}/products/{product_id}.json'
# Headers for the REST API request
headers = {
'Content-Type': 'application/json',
'X-Shopify-Access-Token': ADMIN_API_ACCESS_TOKEN
}
# Make the REST API request
response = requests.get(url, headers=headers)
# Check if the request was successful
if response.status_code == 200:
return jsonify(response.json())
elif response.status_code == 404:
return jsonify({'error': 'Product not found'}), 404
else:
return jsonify({'error': 'Unable to fetch product'}), response.status_code
except Exception as e:
return jsonify({'error': 'An error occurred', 'message': str(e)}), 500
Here is the breakdown:
@Anonymous_bp.route('/'):
@Anonymous_bp.route('/products', methods=['GET']):
@Anonymous_bp.route('/products/<product_id>', methods=['GET']):
Overall, this code defines three routes:
Hopefully this is of some guidance / assistance. Curious what you find, let me know!