Support Center

Getting Started with the Fotomoto API

Last Updated: Jan 10, 2019 03:56PM PST

Overview

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

The Public API gives developers more control over how Fotomoto's Buy links are displayed and function in their web pages.

The Fotomoto Affiliate API gives our partners the ability to use Auto User Registration to create new Fotomoto users via JSON or XML posts, bypassing the typical Fotomoto account registration process. Users signed up via Auto User Registration will receive an email with instructions and a link to where they can complete their account setup (set their password, connect their payment account, set up products and pricing, etc.).

Public API

Getting started

First make sure you have a Fotomoto account. If you don't, just create one here and install Fotomoto on your website using our Getting Started guide.

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 the ?api=true parameter to the end of it as 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 Buy Buttons under a photo

Using the API to insert Buy Buttons is typically a three-step process:

  • Give your associated image a unique ID like this: <img id="image1" src="yourimage.jpg" /> or just use the image's unique URL. 
  • "Check in" the image (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 - getting a Fotomoto Store ID with 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 us an email.

Before you start make sure you append both api=true and aid=[your affiliate key] parameters to the end of your Fotomoto Script. It should look like this:

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

Creating a new Fotomoto user

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

In order to register your users with us you should send us the information below.You can find the necessary key information in your Affiliate Dashboard.

  • 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 list of 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 for the user account.

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. Below is the HTML code to register a user; it is posted to http://affiliate.fotomoto.com/osignup.xml, and will return and XML response:

<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, which will return a JSON response:

<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 

The response to a successful post will look something like this:

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

The response contains the status code, and the site key which is the new user's StoreID.

The response to an unsuccessful post will look something like this:

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

The response contains the status code, and one of these error messages as 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, feel free to post it in our support forums, or you can email us via http://support.fotomoto.com/customer/portal/emails/new.

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