API method user.getStats

Returns global statistics for your user.

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 with 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 user.getStats. If it is not specified, 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.

Response parameters

Name

Type

Description

impressions

number

The number of impressions for all the collections. Impressions are counted each time the widget is loaded.

views

number

The number of views for all the collections. Views are counted each time a user interacts with the widget.

time_spent

number

The average time spent shows how much time people spend viewing the flipbooks.

downloads

number

The number of times your documents were downloaded from your collections.

api_uploads_left

number

The number of uploads left via the API.

Error codes

Name

Type

Description

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.

44

Invalid signature

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

Example

HTML form example

Curl example

curl -F "action=user.getStats"\
-F "apiKey=LK12NS-0-IOBW3S89VVJH12Z"\
-F "signature=2298a6456c1dd2d12b895ce4688ffe31"\
https://api.flipsnack.com/v1/

Responses

XML

20
OK
2945
3719
154
28
53

JSON

{
"code": 20,
"status": "OK",
"data": {
"impressions": 2945,
"views": 3719,
"time_spent": 154,
"downloads": 28,
"api_uploads_left": 53
}
}

JSONP

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