Overview


API includes REST based interface with JSON and transport protocol.

Base url

All API requests go though this base url
http://api.truesocialmetrics.com

Version

Api versions are using names instead of numbers, current version is "gamma", so full URL looks
http://api.truesocialmetrics.com/gamma/

Authentification

All requests to TrueSocialMetrics Api must be authentificated. Auth is based on your email and API key. Example request with authentificaiton
http://api.truesocialmetrics.com/gamma/account?api_user=x@x.com&api_key=2999cccf4896592ebafc8cecdee529
api_user - email associated with your account at True
api_key - unique API access key

or you can use varibales in shell
export TT_API_USER=x@x.com
export TT_API_KEY=2999cccf4896592ebafc8cecdee529
export TT_AUTH="api_user=$TT_API_USER;api_key=$TT_API_KEY"
Using CURL
curl http://api.truesocialmetrics.com/gamma/account?$TT_AUTH

Summary of Resource URL Patterns

Api gives access to the next 4 resources: Account, Source, Metric, Diagnostic
http://api.truesocialmetrics.com/gamma/account
http://api.truesocialmetrics.com/gamma/source
http://api.truesocialmetrics.com/gamma/metric
http://api.truesocialmetrics.com/gamma/diagnostic

HTTP methods

Method Description
GET Retriving specific resource by id or list of resources
POST Creating a new resource based on provided data
UPDATE Updating resource with provided data by id
DELETE Removing resource by id

Responses

Response HTTP headers
HTTP/1.1 200 OK
Host: api.truesocialmetrics.com
Server: nginx
Date: Tue, 18 Feb 2014 05:35:59 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Frame-Options: SAMEORIGIN
Content-Encoding: gzip
Each response is well formated JSON object include 2 section:
  • status
  • response

Status - contains request processing information. Default values
  • ok - correct response
  • error - error request
  • in-process - computation is processing now, please, ask later
  • done - calculation's done

Response - js object depends on API arbitrary structure: single-multilevels lists, maps.

Header - default http headers responses
  • 200 - success
  • 400 - application can't recognise request parameteres
  • 401 - not authorized, verify your token
  • 405 - request not allowed
  • 429 - too many requests