Support Center

Getting Started with the Fotomoto API

Last Updated: Sep 06, 2012 11:13AM PDT

Overview

The Fotomoto API consists of two parts, the Public API and the Affiliate API.

The Fotomoto Public API gives developers a way of embedding Fotomoto's various Buy Button functionalities (buy & share links, etc.) into their web pages manually.

The Fotomoto Affiliate API gives our partners the ability automatically sign up new Fotomoto users, bypassing the typical Fotomoto account registration process. Instead of a user being required to sign up manually, our partners can create accounts for them by passing the required basic information to us via JSON or XML posts. Users signed up via this automatic process will receive an email instructing them how to activate their account, which requires setting a password, setting up products and pricing, etc.

Public API

Getting started

First make sure you have a Fotomoto account. If you don't, just create one at www.fotomoto.com and use any of our setup and installation guides to get Fotomoto up and running on your website.

In the Fotomoto Dashboard > Site > Settings > Site Settings, be sure that your Publishing Platform is "None, I have a custom made website" and Extra Script/Template is set to "None, I'm not using any script or template"

Now find your Fotomoto Script and append ?api=true to the end of it (shown below). This will enable "API mode" on your website and allow you to use any of the Public API functions in your site code.

<script type="text/javascript" src="http:// widget.fotomoto.com/stores/script/123...abc.js?api=true"></script>

 

API reference documents

 

Example - putting a buy button under a photo

Using the API is a usually a simple process. In general there are three steps, as show below:

  • Give your associated image a unique ID (id='mainPhoto') or just use its unique URL. 
  • Check in the image (this will register the image in our Dashboard, and increment its views) like so: 
    FOTOMOTO.API.checkinImage('mainPhoto')
  • Call the showWindow function from our API function page passing it the above parameters like so: FOTOMOTO.API.showWindow(FOTOMOTO.API.BUY,'mainPhoto');

 

Example - Using the getStoreID method

You can generate the unique portion of the Fotomoto script (JavaScript) by using the getStoreID method. The FOTOMOTO.API.getStoreID(url,callback); method can be used to return the unique store ID that is associated with every store. Our script can then be created by inserting the StoreID as shown here:

<script type="text/javascript" src="http://widget.fotomoto.com/stores/script/<uniqueStoreID>.js?"></script>

 

The getStoreID method uses two important parameters, the first is the domain of your website, for example that could be "http://localhost:8092". The second is the callback function, this is just the name of a function on your site that will accept a parameter which is the storeID, such an example function could be:

function callbackFunction(store_id) {storeID = store_id; writeLog("Store ID: " + storeID);} 

 

The resuliting code would then look like this:

FOTOMOTO.API.getStoreID("http://localhost:8092", "callbackFunction");

 

For a complete and working example please consult our sample API page here.

Affiliate API

Getting started

You will need a Fotomoto affiliate account. To request one, please send an email to support@fotomoto.com.
Before you start make sure you append both api=true and aid=[your affiliate key] to the end of your script, it should look like this:

 <script type="text/javascript" src="http://widget.fotomoto.come/stores/script/92219dfc4a16257ba31dea1695bf3349dcc7e142.js?api=true&aid=xxxxxxxxxx"></script>

 

Creating a new Fotomoto user

You can streamline the registration process for your service + Fotomoto by automatically creating a Fotomoto user from your application.

In order to register your users with us you should send us the following information:

  • key: Found in your Fotomoto affiliate page, in the account section labelled API Key
  • affiliate_key: Found in your Fotomoto affiliate page, in the account section labelled Affiliate Key
  • email: Set by the user, an activation email is sent to this address
  • Domain: Set by the user, this is the domain of the users website
  • alternate_sites: comma-separated alternative domains, also set by the user (optional)
  • use_default_pricing: checkbox to enable or disable the default pricing 
  • setup_auto_pickup: checkbox to enable or disable setting up the Auto Pickup feature

 

Log in to your affiliate account to pick up the necessary key information.

Once a new customer is created, they will receive an email with instructions on how to set their password and activate the new account.

We accept form encoded post data and return either JSON or XML.

Here is the html code to register a user; it is being posted to http://affiliate.fotomoto.com/osignup.xml, and will return XML:

<form action="http://affiliate.fotomoto.com/osignup.xml" method="post" target="result" accept-charset="UTF-8" >
   	<label for="api_key">API key:</label>
   	<input id="api_key" name="api_key" type="text" /><br/>
   	<label for="affiliate_key">Affiliate Key:</label>
   	<input id="affiliate_key" name="affiliate_key" type="text" /><br/>
   	<label for="first_name">First Name:</label>
   	<input id="first_name" name="first_name" size="30" type="text" /><br/>
   	<label for="last_name">Last Name:</label>
   	<input id="last_name" name="last_name" size="30" type="text" /><br/>
   	<label for="email">Email:</label>
   	<input id="email" name="email" size="30" type="text" /><br/>
   	<label for="domain">Domain:</label>
   	<input id="domain" name="domain" size="30" type="text" /><br/>
   	<label for="alternate_sites">Alternate site addresses (comma separated):</label>
   	<textarea rows="8" name="alternate_sites" id="alternate_sites" cols="40"></textarea><br/>
   	<div class="chbox">
     	<input type="checkbox" value="1" name="use_default_pricing" id="use_default_pricing">&nbsp;
     	<label for="use_default_pricing">Use default pricing</label><br/>
     	<input type="checkbox" value="1" name="setup_auto_pickup" id="setup_auto_pickup">&nbsp;
     	<label for="setup_auto_pickup">Setup Auto Pickup profiles</label><br/>
   	</div>
   	<input type="submit" id="submit" name="sub" value="Post Affiliate User info">
 </form>


 

Here it is being posted to http://affiliate.fotomoto.com/osignup.json, it will return JSON:

<form action="http://affiliate.fotomoto.com/osignup.json" method="post" target="result" accept-charset="UTF-8" >
   	<label for="api_key">API key:</label>
   	<input id="api_key" name="api_key" type="text" /><br/>
   	<label for="affiliate_key">Affiliate Key:</label>
   	<input id="affiliate_key" name="affiliate_key" type="text" /><br/>
   	<label for="first_name">First Name:</label>
   	<input id="first_name" name="first_name" size="30" type="text" /><br/>
   	<label for="last_name">Last Name:</label>
   	<input id="last_name" name="last_name" size="30" type="text" /><br/>
   	<label for="email">Email:</label>
   	<input id="email" name="email" size="30" type="text" /><br/>
   	<label for="domain">Domain:</label>
   	<input id="domain" name="domain" size="30" type="text" /><br/>
   	<label for="alternate_sites">Alternate site addresses (comma separated):</label>
   	<textarea rows="8" name="alternate_sites" id="alternate_sites" cols="40"></textarea><br/>
   	<div class="chbox">
     	<input type="checkbox" value="1" name="use_default_pricing" id="use_default_pricing">&nbsp;
     	<label for="use_default_pricing">Use default pricing</label><br/>
     	<input type="checkbox" value="1" name="setup_auto_pickup" id="setup_auto_pickup">&nbsp;
     	<label for="setup_auto_pickup">Setup Auto Pickup profiles</label><br/>
   	</div>
   	<input type="submit" id="submit" name="sub" value="Post Affiliate User info">
 </form>

 

JSON/XML response 

A standard successful post will result in something like the following response:

  {"status":200,"error":"","site_key":"f9981088617910ec84f6d9d3e1cc29a86a531eee"} 

The response contains the status code, and the site key which is used as your StoreID.

An unsuccessful post will result in something like the following response:

 {"status":401,"error":"Unauthorized. Wrong affiliate API key/affiliate key","site_key":""} 

The response contains the status code, and the error message, all of which can be found below.

Status codes and their error messages:

200: Successful request
401: Unauthorized. Wrong affiliate API key/secret
403: Invalid parameters or user already present in the system
405: Affiliate and API keys are correct but the Name, Email or Domain is missing 
 

API support

If you have any questions about using the Fotomoto API, you can email us at support@fotomoto.com, or checkout our support forums.

Don't find what you are looking for? Try our community discussions.

Announcements View Discussions

Have A Question?

Recent Discussions

Go to Discussion Forums ​​

Track Your Package

Track your FedEx package
Track Your UPS package


powered by Desk.com