Skip to main content

Getting Started With the Bannersnack API

Learn how to use the Bannersnack Enterprise API. Get your Client ID, sign requests, call API methods, and handle responses with status codes for seamless integration.

Updated this week

This API allows developers to write applications that interact with Bannersnack from a 3rd party system. The API exposes different methods to manage collections, based on an API key provided for that specific user.

What can you do with the API

  • Access the online banner editor;

  • Retrieve a list of collections for the user who owns the API key;

  • Get the embed code for a specific banner.

Abusing the API will get your API key banned and you will not be able to access Bannersnack data as a result. Your API key is available during your Corporate/Business subscription period. Once your subscription ends, we will disable the API key.

Getting started

1. Get your Client ID

The first thing you need to do is obtain your client ID. The client ID is available only for users with active Bannersnack Enterprise accounts. Please note that the client ID is secret and you should not disclose or share it with anyone else.

2. API method

The Bannersnack Enterprise API endpoint which receive API calls is:

Then you must select one of the API methods, depending on what action you wish to perform. You can select the action from the API methods listed in the API Reference.

Each method must receive a set of parameters. You must send these parameters as part of the URL when using HTTP GET requests.

3. Make a request

The request (through GET) must contain at least 4 parameters. The mandatory parameters are:

  • client_id - required for authentication. We associate the user to the client ID provided

  • signature - required for authentication. Bellow you can read about how to sign a request to see how to calculate the parameter

  • action - specifies which method should be executed

  • t - specifies the current timestamp in seconds

Example:

http://www.bannersnack.com/wapi/2.0/?client_id={client_id}&signature={signature}&action={method}&t={timestamp}

4. How to sign a request

All requests to Bannersnack Enterprise API must contain a Client ID provided by us along with the signature of the request. This signature is calculated using a Secret Key which we provide along with the Client ID. The signature proves that you are the owner of the account making the requests.

Note: These keys are secret and they should not be disclosed or shared with anyone else. Bannersnack does know your Client ID and Secret Key and no one who legitimately represents Bannersnack will ask for these keys.

Signing a Bannersnack Enterprise API request is easy:

  1. Sort the request parameters alphabetically, but exclude the signature parameter (example bellow)
    ​action=create-banner, t=1461758852, [email protected], client_id=2AF832
    results to
    ​action=create-banner, client_id=2AF832, [email protected], t=1461758852

  2. Create a string by concatenating the request key-value pairs which were ordered alphabetically
    e.g. actioncreate-bannerclient_id2AF832identifieremail@bannersnack.comt1461758852

  3. The signature is the hash of the previous string generated using HMAC-SHA1 method.

  4. Include the signature parameter to the API request (e.g. signature=0a85db3d41d0b432465d2c5d33d2937904f4ec32).

The final request would look like this:

http://www.bannersnack.com/wapi/2.0/?action=create-banner&t=1461758852&[email protected]&client_id=2AF832&signature=0a85db3d41d0b432465d2c5d33d2937904f4ec32

If the request is incorrectly signed the API will return with the error code "513 - Invalid signature!".

Note: The Client ID, Secret Key and the identifier specified above are all fictional and are used for example purposes only.

5. Parse the response

The response from the API will be in JSON format.

The response body will contain 2 parameters:

  • code - the status code of the response (200 for 'OK'). See other status codes returned by the API

  • data - the actual data sent from the API server (or the error message if the request failed)

6. Handle errors

In case of errors, the response will contain the error code (the code parameter) along with the error message associated (the data parameter). Error messages have a code value higher than 200. Please see the list of status codes for more details.

Note: Status messages are only descriptive. We recommend you to use the status code when checking API responses. You can find the explanation for each status code in the status codes list.


Ready to start designing?

πŸ‘‰ Sign up for a free Bannersnack account – it only takes a minute.
πŸ‘‰ Already have an account? Log in here to continue where you left off.

Did this answer your question?