OK, well, I guess I better introduce you all to the Marketplace API .
The purpose of the API is to enable third party developers (that’s you!) to develop applications using real-time, individualised marketplace data, in a manner that doesn’t require users to compromise their accounts.
Fwoar, that’s a mouthful. So what does that mean?
Every Account now has an API Key.
The API key (which you can find by clicking on ‘Account’, then ‘Edit’ and expanding the ‘API Key’ thing), is a long, long, long and random, long password-like key. It’s what users can provide as an alternative to their password to access API data.
Users can regenerate their API key, but they can’t make up their own (we make up one with the power of computers).
The API provides various ‘sets’ of data in either JSON or XML .
We figured developers would either prefer JSON or XML , so we support these two formats. If you’re a JS or AS developer and don’t know what JSON is, it’s data that is returned as a Object Literal or a Hash. This means you can
eval() the response and access it like a Hash or Object and not have to do any parsing of XML . How cool is that!
Sets of data are not locked down, and we expect to collaborate with the community on what kind of data you’d want to work with. We’ll provide some initial sets, some suggestions and go from there. This is a topic for another thread, so more on that later.
The API is ‘versioned’.
We’ve the ability to ‘version’ our API , so you’ll be able to write an application to a particular version, and be able to sleep at night knowing that it wont break 12 months down the track.
How we’re going to manage this is again, a topic for another thread, which I’ll write in like, soon!
A quick example.
The API is provided over HTTP , so it’s very easy to test and work with. The format of the API URL is the following:
Version the the version label, there will eventually be version 1, version 2, etc. There’ll always be an ‘edge’ version that we chop and change every so often (with the community’s feedback, of course!), and eventually freeze as a new version.
Username and API key are pretty straight forward
The set is the label of the particular data set you want back, and format is what data format you’d like it back in (either json or xml), so let’s have a look at my account’s vitals shall we?
That is a real, working API url. You can click it, and you’ll see the JSON response in the browser. Here it is in XML format:
Neat huh? Now its’ OK. I don’t mind if you can see my balance The API is perfectly safe and separate to the account log in process, and I’m not a real author so I have no secrets to keep
Here’s another example of a set (that has an array):
As you can see, I’ve made a few sales of my controversial song, ‘The Clinton is a Clintonhead Song’.
Combining Sets to reduce HTTP roundtrips.
One of the coolest features of our API is the arbitrary combination of sets to reduce HTTP roundtrips. We expect we might have 30 sets of data you can ask for, and you can ask for them all in one go! We’ve only got ‘vitals’ and ‘recent-sales’ deployed right now, so lets combine them and see what we get:
As you can see, we combine them with a +. And as you can see in the result, you’ve got both sets of data back in that one object literal! The same thing in XML :
Where to from here?
We’ll pre-empt you and add a few more sets of data, then create another thread asking for feedback and make some suggestions of other bits of data you might want.
We’ll also start a thread documenting how you should handle errors that the API may send back to you.
So there you go! Stay tuned for the next round!
Great work, Ryan! I’m really looking forward to having a play around with this and seeing what can be done…
Excellent work Ryan and the Envato Dev team!
Would eventually be good to see a documentation site on the API .
Uuh, I can’t wait to get developing
Is this still disabled, mine just outputs “not_authenticated Username and/or API Key invalid.” when using my username and the generated API (tried regenerating it too)?
Hmm, and now it works with the same url, oh well…
This is really awesome. Can’t wait to see all the data sets!