Access to Shopify API from External Web App

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.

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:

_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/

Here is the breakdown:

1.  @Anonymous _bp.route('/'):

   - This is a decorator for the root route of the /products Blueprint.
   - When a user visits the root URL of the application (e.g., [http://example.com/](http://example.com/)), the index function is called.
   - index returns an HTML template named 'index.html' using render_template. This template could be a landing page or any other content you want to display when users visit the root URL.
1.  @Anonymous _bp.route('/products', methods=['GET']):

   - This is a decorator for the /products route with an HTTP GET method.
   - When a user visits the '/products' URL (e.g., [http://example.com/products](http://example.com/products)), the get_all_products function is called.
   - get_all_products constructs a URL to make a GET request to the Shopify store's API to retrieve all products. It uses the requests library to make the API call.
   - The response is checked for success (HTTP status code 200). If successful, it returns the JSON response with all the products using jsonify. If there's an error, it returns a JSON error message along with the HTTP status code (e.g., 404 for "Product not found" or other status codes for various errors).
1.  @Anonymous _bp.route('/products/<product_id>', methods=['GET']):

   - This is a decorator for the '/products/<product_id>' route with an HTTP GET method. It includes a dynamic parameter <product_id>.
   - When a user visits a URL like '/products/123' (where '123' is a product ID), the get_product_by_id function is called with '123' as the product_id parameter.
   - get_product_by_id constructs a URL to make a GET request to the Shopify store's API to retrieve a specific product based on the provided product_id.
   - Like get_all_products, it checks the response for success and handles different cases: if the product is found (HTTP status code 200), if the product is not found (HTTP status code 404), or if there's an error (other status codes). It returns the appropriate JSON response or error message.

**Overall, this code defines three routes:**

1. The root route that displays an 'index.html' template.
1. A route to retrieve and display all products from the Shopify store's API.
1. A route to retrieve and display a specific product based on its ID from the Shopify store's API.

Hopefully this is of some guidance / assistance. Curious what you find, let me know!