Smart Links Analytics API

Follow

 

Summary

This API can be used to query for Po.st Shortener analytics reports. Base URL for API is

 https://api.po.st/shortener/analytics/v1

 

Report Query

The basic analytics report query looks like:

https://api.po.st/shortener/analytics/v1/{report path}?accessToken={token}

 

{report path} – there are 3 reports currently available (click "Expand source" to see response):

/daily 

clicks count aggregated for all links of all available accounts grouped by day. 

clicks count aggregated for each link of all available accounts.

 

/links/daily

clicks count aggregated for each day and grouped by link for all available accounts

Parameters

Name Description  
accessToken Each request is authorized by accessToken parameter can be found / generated on "My Profile" page of Shortener UI
startIndex 

used for results pagination

by default:

  • startIndex=0
  • maxResults=20
maxResults 
startDate Start date for fetching Analytics data. Requests can specify a start date formatted as YYYY-MM-DD,

 

 

 

 

these parameters specify filters for report data and must be URL encoded

endDate End date for fetching Analytics data. Request can specify an end date formatted as YYYY-MM-DD,
hash

Filter the report data to include only link with hash specified

shortUrl The same as 'hash' filter but specifies short link by it's full representation (e.g. po.st/a1b2c3)
tags

Include only links that contains corresponding tags.  Tags can be combined using OR and AND boolean logic

  • OR operator is defined using a comma (,)

https://api.po.st/shortener/analytics/v1/{report path}?accessToken={token}&tags=tag1%2Ctag2%2Ctag3

  • AND operator is defined using a semi-colon (;)

https://api.po.st/shortener/analytics/v1/{report path}?accessToken={token}&tags=tag1%3Btag2%3BCtag3

apiKey

Filter the report data to include only links from particular Campaign with API-key specified

 

 

Response Format

Currently only JSON format is supported. 

  • Accept headers are ignored.
  • Response contains header  
Content-Type: application/json;charset=UTF-8

 

Errors

If API request is successful, the API returns a 200 HTTP status code along with the requested data in the body of the response.

If an error occurs with a request, the API returns an HTTP status code and reason in the response based on the type of error. Additionally, the body of the response contains a description of what caused the error. Here's an example of an error response:

{
   "error": {
      "code": 401,
      "message": "Missing 'accessToken' parameter"
   }
}

Note

The description could change at any time so applications should not depend on the actual description text.

The following list shows the possible error codes, reasons, corresponding descriptions, and recommended action.

 
 
Code
Message
 
400

Invalid value for {filter name}

error in parsing a value passed for specified filter. For example startIndex  should be positive integer but got a "-5" in request
400

'tags' filter can not contain both ',' and ';'

 
401

Missing 'accessToken' parameter

 
401

Unauthorized

Not valid accessToken was provided
403

Blocked

 accessToken is blocked. If you think it shouldn't then please contact support@po.st
404 Not found Unknown report requested. Currently three reports supported: /daily , /links and /links/daily
404

shortUrl '{shortUrl}' not found

Unknown shortUrl requested to generate report
405

Method not allowed

Report was requested with some HTTP method other then GET

429

Rate limit exceeded

Rate limit for provided accessToken has been exceeded. The maximum rate limit is 100 queries per minute.
500

Internal error

 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk