Serving JSON pages via JSONbin.io

Overview

When combined with JSONbin.io, Arigato Automation can create a machine-readable data source that other applications and services can consume, such as Smiirl or any custom web application.   

JSONbin.io is a "freemium" service with a generous free plan as well as a paid "pro" plan.

Arigato Automation's role is to gather the data from Shopify on a schedule and send it to JSONbin.io. JSONbin.io's role is to track the most up-to-date version of the data and serve formatted JSON GET requests to the web application of your choice.

Create an account on JSONbin.io

  1. Visit jsonbin.io and click on create an account.
  2. Click on one of the social accounts to sign up using your account on that service. 

Create a "Bin" on JSONbin.io (AKA an endpoint)

From your Dashboard, click on "Create New"

On the following page, set the Bin to Public if appropriate for your application, enter some test data, and click Create.

In our example, we used the following test code:

{   "hello_world": "true" }

Copy the link and paste it into your browser to confirm it works as expected.

Create a workflow in Arigato 

Your workflow will be likely be customized to your needs. In our example, we are fetching a count of all open orders from Shopify via the Shopify API and sending the count on to JSONbin as the data we want them to host for us. 

The basic ingredients of this type of workflow are:

  1. Data gathering via either an event based workflow or an on-demand/scheduled workflow.
  2. An HTTP Action in Arigato with a PUT request to update your bin in JSONbin.

Download and import this workflow to see how all these parts come together as a demonstration. Be sure to change the JSONbin URL in the imported workflow to match your own bin's URL.

Note, the linked workflow's Triggers are set to "Custom HTTP Request" to allow triggering a test from the browser. Depending on your use case, you will likely want to change the trigger to on-demand and schedule the workflow to run at a set interval or change to an event based workflow that updates as events happen in your store.

Test your workflow & your bin

Within the imported workflow, click on the Test Workflow link and set the Request Method to POST and click on Run Workflow.

Go to the Stats page for the workflow. If all works as expected (using our demonstration workflow) the main workflow will show a success message and the HTTP Request subworkflow will show a success message from JSONbin.io. 

JSONBin Versioning 

To retrieve the current version of your bin, take the bin URL and add /latest to the end. 

https://api.jsonbin.io/b/{parent-key}/latest