2 User Stats API
Tom Bloor edited this page 2017-05-16 22:03:44 +01:00

User Stats API

POST /api/stats

Takes an application/json payload. Returns minor stats for today.

Request JSON

{
  session_key : <session_key>
}

Response JSON

Success

Response code of 200 OK

{
  success : true,
  today_sum : <sum of transactions for user>,
  today_count : <count of transactions for user>,
  week_sum : <sum of the last 7 days for user>,
  week_count : <count of the last 7 days for user>,
  month_sum : <sum of the last 30 days for user>,
  month_count : <count of the last 30 days for user>,
  user_sum : <sum of all transactions for user>,
  user_count : <count of all transactions for user>,
  global_sum : <sum of all global transactions>,
  global_count : <count of all global transactions>
}

Failure

If something is missing from the request, or is invalid, you will get a response code of 400 BAD REQUEST and the following:

{
  success : false,
  message : <error message>
  error : <error type>
}

If there was a server error, you will get a 500 SERVER ERROR and possibly the following:

{
  success : false,
  message : 'An unknown error occurred when adding the transaction'
  error : 'server_error'
}

The error messages should describe what was wrong with the submission