About the Shopify category

Add topics about this connector package here.
Always check the ‘How to use the Alumio connector packages’ topic.

Extra information

System documentation: REST Admin API reference

To get Credentials : Go to Shopify Admin Store > Settings > Apps and Sales Channels > Develop App > Allow Custom App Development > Create App > Api Credentials > Install App.

Connector package documentation

​​Table of Contents

  • 1. Setting up HTTP Client Shopify
    • 1.1 Steps
  • 2. Subscribing to entities from Shopify
    • 2.1 Steps
    • 2.2 General concept
  • 3. Publishing entity to Shopify
    • 3.1 Steps
    • 3.2 General concept
  • 4. Query In Alumio

1. Setting up HTTP Client Shopify

1.1 Steps

  1. Before we begin we need to create a Shopify App and Access Key according this guide https://help.shopify.com/en/manual/apps/app-types/custom-apps?shpxid=e548f649-C815-42D8-0E87-2A52F4EF2669#get-the-api-credentials-for-a-custom-app.
    • In the Shopify Dashboard create the APP first at Shopify > Apps > Develop Apps > Create
    • After the APP is created we can generate a token at
      API Credentials > Configure Api Admin Scopes >
      [Click all Entities you want to access] > Save > Install App >
      Api Credentials > Admin Api access token.
  2. In the Alumio Dashboard, go to
    Clients > HTTPS Client.
    Create a new HTTP Client and select Shopify Client as the prototype of the HTTP Client.
  3. Fill in the Base URI and X-Shopify Access Token (this token is the one we generate before)
  4. You can optionally enable the logging of request to get the log of the authentication.
  5. Save the HTTP Client.

2. Subscribing to Entities from Shopify

2.1 Steps

  1. Go to Connections → Incoming and create a new incoming configuration and select Shopify Subscriber as the subscriber.
  2. Select the entity you want to subscribe from Shopify.
  3. Add any request parameters needed to subscribe to the entity (optional).
  4. You can optionally add a transformer to transform the request parameters into something you need.
  5. Select the Shopify HTTP Client to use.
  6. You can add a pagination feature to allow Alumio to fetch a paginated entity.

2.2 General Concept

We follow the Shopify documentation for building this connector, so you can easily use the connector based on the Shopify API Reference.

Entity

This is the entity you want to subscribe yo from Shopify. Please refer to the entities in the Management APIs from Shopify API Reference page.

Request Parameters

These are the parameters you can provide to get the needed entity based on the Shopify API Reference. Please look at the example below on how to fill the Request Parameters field when subscribing to a Single Request entity.

It means that we want to subscribe to a product with a certain ID.

  • “Path” is the path parameter of the URL. For example the {id}.
  • “Query” is a defined set of parameters attached to the end of a URL.
    Example: URL.com - MediaOptions

That’s why we need to define the product_id key inside path data in the Request Parameters field. The final URL would look like /admin/api/2022-01/products/632910392.json

Input Transformer

Any transformers set here will be executed before the Request Parameters are loaded. So, you basically can add any transformer to provide and transform the data into anything you need before using it on Request Parameters.

HTTP Client

This is the HTTP Client configuration or prototype you will use to access Shopify.

3. Publishing entity to Shopify

3.1 Steps

  1. Go to Connections → Outgoing, create a new outgoing configuration and select Shopify Publisher as the publisher.
  2. Select the action that you want the publisher to do with the data.
  3. Select the Shopify entity you want the data to be published to.
  4. You can optionally add any query parameters to the request.
  5. You can also optionally add any transformers to transform the data into anything you need before submitting it to Shopify.
  6. Select the HTTP Client to use.

3.2 General Concept

Like the subscriber, the publisher has similar methods on how to use it. The difference is the payload that will be submitted by the publisher originating from the data (from routes, from transformers in outgoing configuration), though you can also add or modify payload using the Request Transformer.

Action

Currently we support Create (HTTP POST method), Put (HTTP PUT method) and Delete (HTTP DELETE method) entities.

Entity

We support publishing to most Shopify endpoints. Please refer to the entities in Management APIs from Shopify API Reference page. Based on the documentation, some endpoints may need one or more path parameters.

For example, we want to Delete a Product. Select “Delete” as the action and “Delete a Product” as the entity of the publisher.


image

The Shopify documentation says that we need product_id as path parameters.
In that case, you need to provide the product_id into the key “path” of JSON data before the request called in the Publisher. You can also put the payload you want to send to Shopify using the JSON Key “payload” in the data. Here is an example of the JSON Response after deletion.
image

You can put the payload you want to send to Shopify into a key payload in the data.
For example, when we try to “Creates a Discount Code” for a product.


image

The endpoints look like this.
/admin/api/2022-07/price_rules/{{price_rule_id}}/discount_codes.json

In this case, we have to include price_rule_id inside the path parameter and here is an example of the data:

  • “Path” is the path parameter of the URL. For example the {id}.
  • “Query” is defined set of parameters attached to the end of a URL.
    Example: URL.com - MediaOptions
  • “Payload” is the data contained within a request.

Here is the Response from Shopify after the discount is created.

HTTP Client

This is the HTTP Client configuration or prototype you will use to access Shopify.

4. Query In Alumio

In Alumio, we define query as a JSON object. For example, when we try the end point Search customer.

image

The Query in the end point looks like this:

/admin/api/2022-01/customers/search.json?query=Bob+country:United+State

To create them in Alumio please create the query as:

Another example is when we want to retrieve a single asset:

Create the query in Alumio as:

There is another example with multiple fields that can be done in the following way: