State of the API: July 29th 2011

David Underwood

 

Everyone's favourite API update column is back for a second round, and it's coming out swinging!

Let's see who our contenders are tonight:

  • Customer Deletion - In order to bring customers in line with other objects in the API, you can now delete them. The only caveat is that all orders associated with that customer must be deleted first otherwise you'll get an error.
  • Protocol Relative Script Tags - Previously you had to specify the protocol when creating script tags: Either http or https for the checkout. Now you can skip that part and Shopify will figure out which protocol it needs to insert the script into a page. If you're using our Rails API client, you can do something like this:
    ShopifyAPI::ScriptTag.new(:event => 'onload', :src => '//djavaskripped.org/fancy.js')
  • JSONP support - This is a biggie: You can now specify a callback function on any json resource and the response will be returned as a parameter to the function you specify. What is this good for? Well, JSONP gets around the 'same origin' policy that prevents regular javascript from communicating with other domains. Couple this with the fact that any public Shopify resource (i.e. products) can be fetched as json by appending '.json' to the url and you have the ability to fetch products from shops from third party sites using javascript. One of our rockstar developers is working on an example, but in the meantime you can read all about JSONP on Wikipedia

And that's the bell! Come back in two weeks and I'll have more knock-out updates for you. Until then, sign up for our Developer Google Group if you have any API related questions, comments, or issues. Thanks!