Beginning Tutorial

We're going to show you how to manage your buyback functions in PHP. If you use another language, don't worry-- these concepts translate easily.

The first thing we're going to do is fetch an item's metedata. If we look at the glossary at Get Metadata, we'll see we need our company API username and API key, how we want our results formatted, the method name ('get_metadata'), and the item's ISBN.

Your company will have received a username and an API key upon signing up, so we'll assume you already have those (not sure where to look? Try your Company Controls page!). Our method name is supplied, so now we need to decide whether to get our results back in json or xml format. Either is fine, but let's assume we picked json.

Here is what our URL looks like:[sampleUsername]&api_key=[sampleApiKey]&method=get_metadata&isbn=9781429234146&results=json

Assuming your credentials are right, if you visited this URL, you'd get a json object containing our success (true or false), our success or error message, and a metedata array.

Of course, you won't be expected to manually save your metadata. Let's automate that, shall we?


    $url = '[sampleUsername]&api_key=[sampleApiKey]&method=get_metadata&isbn=9781429234146&results=json';
    $results = json_decode(file_get_contents($url));
        $metadata = $results['metadata'];

And done! We have our metadata.

That's really all there is to it. You can find information about each of the functions in our glossary, including how its results are formatted in xml or json. If you need help after covering all our material, check out our FAQ. Still having trouble? Tell us about it and we'll do our best to solve your problem.