APIs

Working with APIs is great. That said, many of us just want a quick way get some data into a spreadsheet to make a report. For this, directly interacting with APIs in their raw format can be a step removed from what we need.

We want to make it super-easy for you to use and analyse your iStockist data. With the following two steps you can be up and running with live data into your spreadsheet in minutes.

  1. How to set up a google spreadsheet to interact with the iStockist API.
  2. How to pull in the data you need for the iStockist API.

1. Set up a google spreadsheet to interact with the iStockist API

Preliminary note: If Step 1 causes you any issues, you can open a ready made template here. Open the template, click on ‘Make a copy’ and save the copy of the template to your google drive.

reports istockist API google spreadsheets ordering system

  1. Open a spreadsheet in Google Spreadsheets. Select Tools > click Script Editor.

    google spreadsheet
  2. Copy this script into the text area and press save.

Credit for the script goes to Brad Jasper, Karsten Lettow and Trevor Lohrbeer. The homepage for the importJSON repository is here

istockist api

Give yourself a pat on the back. You’ve set things up. Now it’s time for some fun! 🙂

2. Pull in the data you need from the iStockist API

  1. With the template, on the first tab ‘Keys’, where you see customer_key and customer_secret, enter your iStockist api keys. Here’s how to find your iStockist api keys.

  2. You can use the command ImportJSONBasicAuth from the script to interact with the API. It’s similar to doing other spreadsheet formulas like SUM or AVERAGE.
  3. You can use the command ImportJSONBasicAuth from the script to interact with the API. It’s similar to doing other spreadsheet formulas like SUM or AVERAGE.
  4. The formula works like this:
    =ImportJSONBasicAuth(url, customer_key, customer_secret)
    where:

    • url is the link to the type of data you want from the iStockist API.
    • And customer_key and customer_secret are your iStockist api keys. Here’s how to find your iStockist api keys
    • Get Orders: To get all orders, split into an order line per row, use this command:
      =ImportJSONBasicAuth("https://trade.istockist.com/api/v1/orders", customer_key, customer_secret)
    • Get Customers:, split into a customer contact per row, use this command:
      =ImportJSONBasicAuth("https://trade.istockist.com/api/v1/orders", customer_key, customer_secret)

      istokist api load data

Good job! Your data from iStockist should now populate in the spreadsheet.

Notes and disclaimers:

  • Your api keys are the equivalent of your username and password. Make sure to store them safely just like any other sensitive password information. Do not share your secret API keys in publicly accessible areas such GitHub, client-side code, and so forth.
  • All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Any questions? Feel free to contact us.
Or if you need an ordering system Sign up for a free iStockist account and check it out.