First draft - JavaScript Library for Behance Integration

This post is more than 2 years old.

Back in April of this year I blogged about how you could create a "widget" version of your Behance portfolio on your web site. This was done using a little library I built and a user's RSS feed. By using the RSS feed we could bypass the somewhat strict limits on the Behance API (150 hits per hour). I had a few people ask about using the real API so I decided to take a stab at it today.

I've begun with the simplest use case imaginable, getting the projects for a single user. First, you begin with your HTML template.

<!doctype html>
<html lang="en">
		<h1>Regular Site</h1>
		Some vanilla content.

		<h1>My Projects</h1>
		<div id="projects">
		<script src="jquery-2.0.0.min.js"></script>
		<script src="behance_api.js"></script>
		<script src="demo1.js"></script>

Nothing special here. I've got a basic template with an empty div block I'll be using to display my templates. I'm loading jQuery as a dependency, my new library, and demo1.js, which is just the JavaScript file for this page. Let's look at that next.

/* global $,console,document,behanceAPI */
var behancekey = "vNvOiZI0cD9yfx0z4es9Ix6r4L2J7KdI";

$(document).ready(function() {
	//Set my key
	//Now get my projects
	behanceAPI.getProjects("gwilson", function(p) {

		//Manually draw them out	
		var s = "";
		for(var i=0; i<p.length; i++) {
			var proj = p[i];
			s += "<h2>" + + "</h2>";
			s += "<p>";
			s += "<a href='" + proj.url + "'><img src='" + proj.covers[404] + "'></a>";
			s += "</p>";


In this demo, all I'm doing is setting the API key (see note below) and then running the getProjects call. The method takes two arguments - the user and the function to run after the data has been fetched. I do not have any error handling yet, that will come later. The result is simply an array of projects that you can display however you want. In this case I just create a big ugly string. Typically you would want to use something like Handlebars instead.

The actual library itself is pretty simple:

/* global console,$ */
var behanceAPI = function() {
	var key;
	var baseURL = "";
	function setKey(k) {
		key = k;	
	function getProjects(user, cb) {
		var url = baseURL + "users/" + user + "/projects?api_key=" + key + "&callback=";
		$.get(url, {}, function(res, code) {
		}, "JSONP");
	return {
		setKey: setKey,
		getProjects: getProjects	

So, because of the limits Behance puts on API calls, I decided not to put this demo online. (And yes, I realize my own key is up there!) Instead, I've attached a zip of the project to this blog entry. Here is a screenshot of the result:

Not terribly exciting yet, I know. But - I'm thinking that in my next revision, I'm going to allow you to create a simple template, pass it to the library, and have the output handled for your automatically. My thinking is that many of the people who may use this API are creatives who may not have much JavaScript experience.

Download attached file.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Raymond Camden posted on 10/16/2013 at 6:16 PM

I've got a rough draft of the second version with a render function built in as well. Again - the thinking being that you may not want to use JS to draw out your crap.