ThemeForest

A brief introduction to the API.

578 posts
  • Has been a member for 5-6 years
  • Contributed a Blog Post
  • Attended a Community Meetup
  • Envato Staff
  • Envato Developer
  • Exclusive Author
  • Bought between 50 and 99 items
  • Australia
  • Referred between 1 and 9 users
ryan says

Hi everyone!

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:

http://marketplace.envato.com/api/version/username/api-key/set.format

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?

Example

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:

Example

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 :P

Here’s another example of a set (that has an array):

Example

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:

Example

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 :

Example

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!

Posted 3 years ago VIA ActiveDen | Permalink
ryan is an Envato staff member
6 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Beta Tester
  • Bought between 1 and 9 items
dirt_burger says

What is an API ?

Posted 3 years ago VIA ActiveDen | Permalink
150 posts
  • Has been a member for 5-6 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Bought between 10 and 49 items
  • China
  • Referred between 10 and 49 users
shuhankuang says

Cool!

Posted 3 years ago VIA ActiveDen | Permalink
100 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Envato Staff
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 10 and 49 items
  • Australia
  • Referred between 1 and 9 users
Japh says

Great work, Ryan! I’m really looking forward to having a play around with this and seeing what can be done…

Thanks! :)

Posted 3 years ago VIA ActiveDen | Permalink
Japh is an Envato staff member
burningstonecold

burningstonecold Recent Posts
Threads Started

143 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Exclusive Author
  • Sold between 1 and 100 dollars
  • Bought between 10 and 49 items
  • Australia
burningstonecold says

Excellent work Ryan and the Envato Dev team!

Would eventually be good to see a documentation site on the API .

Posted 3 years ago VIA ActiveDen | Permalink
23 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 1 and 9 items
  • Finland
  • Referred between 1 and 9 users
Lahdekorpi says

Uuh, I can’t wait to get developing :)

Posted 3 years ago VIA ThemeForest | Permalink
23 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 1 and 9 items
  • Finland
  • Referred between 1 and 9 users
Lahdekorpi says

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)?

Posted 3 years ago VIA ThemeForest | Permalink
23 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 1 and 9 items
  • Finland
  • Referred between 1 and 9 users
Lahdekorpi says

Hmm, and now it works with the same url, oh well…

Posted 3 years ago VIA ThemeForest | Permalink
485 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 1 and 9 items
  • India
  • Referred between 1 and 9 users
iceonflames says

This is really awesome. Can’t wait to see all the data sets! :)

Posted 3 years ago VIA ActiveDen | Permalink
297 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Beta Tester
  • Sold between 100 and 1 000 dollars
  • Bought between 50 and 99 items
  • United States
  • Referred between 1 and 9 users
BrianCoyDesign says

when I click on the links it tries to download a file instead of show me the example in IE 7 .

Posted 3 years ago VIA GraphicRiver | Permalink
by
by
by
by
by