Curiator JavaScript API v0.1
The Curiator Javascript API lets you embed Curiator content in your own web pages. It is a free service, available for any web site that is free to consumers. The Curiator Javascript API is written as a jQuery plugin and is a work in progress, so if you have suggestions or requests, please feel free to reach out to .
API Key
Applications that use our API need to use an assigned API key. Using an API key enables you to monitor your application's API usage, and ensures that Curiator can contact you about your application if necessary. An API key can only be used on the domain it is registered for.
IP limit
If you call the Curiator API from a server as a REST API (eg. via curl), we recommend you restrict the use of the API key to your server IP(s). This is to prevent unauthorized use of your API key.Getting Started
You can download a Zip with working samples from GitHub
(on your right), or you can start from scratch:
-
Download the API jQuery plugin script:
jquery.curiator.min.js. -
Download the javascript libraries our API depends on:
jQuery library
JSON library
- Get an API key (below) and go wild.
Download ZIP from GitHub
This archive contains all API files and working samples.
Our GitHub repository:
https://github.com/curiator/javascript-API
Your API Keys
Create API Key
Example
The easiest way to get started is with a simple example. The following web page displays all artwork images of an artist.
<!DOCTYPE html> <head> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/json2/20150503/json2.min.js"></script> <script src="//curiator.com/static/js/jquery.curiator.min.js"></script> <script> $(document).ready(function() { var apiKey = 'xxxxxxx'; $('#my-div').curiatorGet({ 'key': apiKey, 'path': '/artist', 'username': 'takashi-murakami', 'size': 's' }, function(data) { var html = []; for (var i = 0; i < data.length; ++i) { html.push('<img src="' + data[i]['src'] + '" />'); } $('#my-div').html(html.join('<br />')); }); }); </script> </head> <body> <h1>Artist images:</h1> <div id="my-div"></div> </body> </html>
Documentation
Get user data by username
If no username is defined, the user will be set to the currently logged in user.
$('#my-div').curiatorGet({ 'key': apiKey, 'path': '/profile', 'username': 'jennie', }, function(data) { //console.log(data); });
Get user artwork collection by username.
This call returns what you see in someone's collection. If no username is defined, the user will be set to the currently logged in user.
$('#my-div').curiatorGet({ 'key': apiKey, 'path': '/profile/collection', 'username': 'jennie', 'size': 's', 'limit': 10 }, function(data) { var html = []; for (var i = 0; i < data.length; ++i) { html.push('<img src="' + data[i]['src'] + '" />'); } $('#my-div').html(html.join('<br />')); });
- 's' (150 px x 150 px)
- 'm' (max. 250 px wide)
- 'l' (max. 730 px wide)
- 'x' (max. 1000 px wide)
Get artworks by artist username
This call returns what you see on the artist page.$('#my-div').curiatorGet({ 'key': apiKey, 'path': '/artist', 'username': 'takashi-murakami', 'size': 's', 'limit': 10 }, function(data) { var html = []; for (var i = 0; i < data.length; ++i) { html.push('<img src="' + data[i]['src'] + '" />'); } $('#my-div').html(html.join('<br />')); });
- 's' (150 px x 150 px)
- 'm' (max. 250 px wide)
- 'l' (max. 730 px wide)
- 'x' (max. 1000 px wide)
Get artist profile by artist username
This call returns what you see on the artist page.$('#my-div').curiatorGet({ 'key': apiKey, 'path': '/artist/profile', 'username': 'takashi-murakami', 'size': 'l' }, function(data) { var html = []; html.push('<img src="' + data['src'] + '" />'); html.push('<br/><br/>'); html.push('Name: ' + data['artist_name']); html.push('Country: ' + data['country']); $('#my-div').html(html.join('<br />')); });
- 's' (150 px x 150 px)
- 'm' (max. 250 px wide)
- 'l' (max. 730 px wide)
- 'x' (max. 1000 px wide)