Client side javascript library

What is it?

A lightweight javascript library for accessing the farmaframe api.

Getting started

Getting started is a simple three step process:

1. Request a farmaframe api account

Contact info@farmaframe.be for pricing and purchase details.

2. Register your domains

We don't want just anyone using your account on their website. So you'll have to request a client key for each of your domains.

You start out by requesting a client key. To do this you do a POST to /account/{apikey}/clientkey:

curl -k -v -u "{apikey}:{apisecret}" -H "Accept-language: nl" --data '' "https://api.farmaframe.be/v1/account/{apikey}/clientkey"

You will receive a HTTP 201 response. The location header will tell you where you can find your client key

Location: {keylocation}

A simple GET request to this url will tell you your client key.

curl -k -v -u "{apikey}:{apisecret}" -H "Accept-language: nl" {keylocation}

The response:

{"key":"48e803e1-0cbf-4e65-96a1-3fd2bc025bbf","locations":[]}

Now you can add domains to this client key. Generally you will want to do this four times for each domain: http://yourdomain.tld, https://yourdomain.tld, http://www.yourdomain.tld and https://www.yourdomain.tld . After each request you will receive a HTTP 201 response.

curl -k -v -u "{apikey}:{apisecret}" -H "Accept-language: nl" --data 'location={yourdomain}' "https://api.farmaframe.be/v1/clientkey/{clientkey}/location"

3. Include required javascript files

Include our javascript library and a recent jquery version in your page.

<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="https://api.farmaframe.be/v1/static/clientlib/js-api/lib/1.0.0/farmaframe-api.js"></script>

Documentation

Debugging authentication

The client side library uses a special authentication scheme. If you are not getting the desired results, you may want to check the debugging information.

Api documentation

Consult the client library api documentation.

Demo: Product information sheets

A demo page that uses the client side javascript library to display product images. A similar technique can be used for nearly every website that needs to display product images.