API method collection.getEmbed

Returns the embed code for a specified collection based on a set of embed parameters.

Note: Requests must be made to https://api.flipsnack.com/v1.

Request parameters

Name

Type

Description

apiKey (required)

string

The API key provided for your user. If it is not specified, the request will return the error code "30 - Missing mandatory parameter". If the key is incorrect the request returns the error code "41 - Invalid credentials".

signature (required)

string

The signature must be calculated by you and added to the request. See How to sign a request for more information. If the parameter is missing the request will return the error code "30 - Missing mandatory parameter". If the signature is incorrect the request will return the error code "44 - Invalid signature".

action (required)

string

The API method that should be called. In this case the value should be collection.getEmbed. If it is not specified, the request will return the error code "30 - Missing mandatory parameter".

collectionHash (required)

string

The hash of the collection for which you want the embed code. If you do not specify a collection hash, then the request will return the error code "30 - Missing mandatory parameter".

format

string

The format of the response from the server. Possible values are json, jsonp and xml. If you set format to jsonp, you must also specify the callback parameter.

Default: json.

callback

string

The name of the callback function used for the jsonp response. This parameter is required if format is set to jsonp. Otherwise it is ignored.

https

boolean

If set to true, the embed code will load the Flipsnack widget from our HTTPS location.

Default: false.

responsive

boolean

If set to true, the Flipsnack embed will have the width and height set to 100% and it will take the entire size of the container.

Default: false.

startPage

number

The page number where the flipbook will open automatically.

Default: 1.

startBook

number

The widget will automatically open the specified flipbook from the collection.

Default: 1.

width

number

The width of the embed. By default it will have the size specified by the collection width parameter. The collection width can be set when creating a new collection or when editing/updating an existing collection.

height

number

The height of the embed. By default it will have the size specified by the collection height parameter. The collection height can be set when creating a new collection or when editing/updating an existing collection.

Response parameters

Name

Type

Description

embedCode

string

The embed code as requested with the API call: iframe or object embed.

Error codes

Code

Message

Explanation

30

Missing mandatory parameter

The request does not contain one or more required parameters. There are at least 3 required parameters for every request: apiKey, signature and action. Other methods may also have extra mandatory parameters. Please check the API Reference for more information.

31

Requests per second limit exceeded

There were too many requests per second made with the same API key.

32

Requests per minute limit exceeded

There were too many requests per minute made with the same API key.

40

Bad request

  • You made a POST request for an API call that is not uploading files.

  • You made a GET request for an API call that uploads files.

  • Your request is incorrectly formatted or the URL is invalid.

41

Invalid credentials

The API key provided in the request is invalid.

42

Invalid action

The API method you specified in the request is incorrect. Please see the API Reference for the list of possible methods.

43

Forbidden

You are not allowed to access the specified collection: it has been deleted or the collection belongs to another user.

44

Invalid signature

The signature you provided is incorrect - it does not match the request.

46

Invalid collection hash

You are trying to access a collection that does not exist.

Example

HTML form example

‚Äč

Curl example

curl -F "action=collection.getEmbed"\
-F "apiKey=LK12NS-0-IOBW3S89VVJH12Z"\
-F "collectionHash=d3m0h45h"\
-F "signature=2298a6456c1dd2d12b895ce4688ffe31"\
https://api.flipsnack.com/v1/

Responses

JSON

{
"code": 20,
"status": "OK",
"data": {
"embedCode": ""
}
}

JSONP

callbackFunctionName({data});
// callbackFunctionName is the function name specified by the callback parameter, in the request
// the {data} is the actual JSON response