Analytics

All analytics endpoints have path prefix /analytic-service. User must have report_viewer role from a participant to request analytics.

Optional parameters from_date (2000-01-01 by default) and to_date (2100-01-01 by default) may be used to restrict analyzed time period.

Custom filtering based on participant index schema may be used with all endpoints by means of optional filter value. It's a JSON object value where keys are field names as they are in participant index schema (see fields value in participant index schema in Index service API). Only products with the specified values will be counted.

Number of Scans

By Month

Number of scans grouped by month. Response will contain months array of data points. Each entry contain year and month fields, along with the number of scans. Entries are ordered by year and month.

POST /analytic-service/scans/get_months
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "months": [
    {
      "year": 2017,
      "month": 4,
      "scans": 77
    },
    {
      "year": 2017,
      "month": 5,
      "scans": 89
    }
  ]
}

By Week

Number of scans grouped by week. Response will contain weeks array of data points. Each entry contain year and week (week number from 1 to 53) fields, along with the number of scans. Entries are ordered by year and week.

POST /analytic-service/scans/get_weeks
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "weeks": [
    {
      "year": 2017,
      "week": 3,
      "scans": 45
    },
    {
      "year": 2017,
      "week": 4,
      "scans": 33
    }
  ]
}

By Day

Number of scans grouped by day of month. Response will contain days array of data points. Each entry contain year, month and day fields, along with the number of scans. Entries are ordered by the date.

POST /analytic-service/scans/get_days
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "days": [
    {
      "year": 2017,
      "month": 4,
      "day": 28,
      "scans": 13
    },
    {
      "year": 2017,
      "month": 5,
      "day": 3,
      "scans": 15
    },
    {
      "year": 2017,
      "month": 5,
      "day": 4,
      "scans": 5
    }
  ]
}

By Country

Number of scans grouped by country. Response will contain countries array of data points. Each entry contain country field (country code or null if there were no country associated with a scan), along with the number of scans. Entries are ordered by the number of scans. Number of returned results may be limited with the limit argument (100 by default).

POST /analytic-service/scans/get_countries
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
limit number Limit the number of returned countries
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "limit": 100,
  "countries": [
    {
      "country": "036",
      "scans": 45
    },
    {
      "country": "156",
      "scans": 40
    },
    {
      "country": "724",
      "scans": 32
    }
  ]
}

By City

Number of scans grouped by a city in the specific country. Response will contain cities array of data points. Each entry contain city field (name of the city or null if there were no city associated with a scan), along with the number of scans. Entries are ordered by the number of scans. Number of returned results may be limited with the limit argument (100 by default).

POST /analytic-service/scans/get_cities
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
country string Group scans by cities in country with this code
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
limit number Limit the number of returned cities
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "limit": 100,
  "country": "036",
  "cities": [
    {
      "city": "Melbourne",
      "scans": 20
    },
    {
      "city": "Sydney",
      "scans": 5
    },
    {
      "city": "Brisbane",
      "scans": 2
    },
    {
      "city": "Perth",
      "scans": 2
    }
  ]
}

By Shop

GET /analytic-service/scans/get_shops
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
country string Group scans by cities in country with this code
city string Group scans by shops in this city
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
limit number Limit the number of returned shops

By User Age

Number of scans grouped by user age. Response will contain ages array of data points. Each entry contain age field (age of the users or null for users with unspecified birthdate), along with the number of scans. Entries are ordered by the age value. User scans may be filtered by user gender and/or user Shping level.

POST /analytic-service/scans/users/get_ages
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
gender string Only count scans by users of this gender
level string Only count scans by users of this level
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
Example Response
{
  "ages": [
    {
      "age": null,
      "scans": 1
    },
    {
      "age": 15,
      "scans": 3
    },
    {
      "age": 16,
      "scans": 8
    },
    {
      "age": 22,
      "scans": 8
    }
  ],
  "from_date": "2000-01-01",
  "to_date": "2100-01-01"
}

By User Gender

Number of scans grouped by user gender. Response will contain genders array of data points. Each entry contain gender field (users gender or null for users with unspecified gender), along with the number of scans. Entries are in no particular order. User scans may be filtered by user Shping level.

POST /analytic-service/scans/users/get_genders
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
level string Only count scans by users of this level
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
Example Response
{
  "from_date": "2000-01-01",
  "genders": [
    {
      "gender": null,
      "scans": 155
    },
    {
      "gender": "male",
      "scans": 43
    },
    {
      "gender": "female",
      "scans": 438
    }
  ],
  "to_date": "2100-01-01"
}

By User Level

Number of scans grouped by user level. Response will contain levels array of data points. Each entry contain level field (users Shping level or null for users with no level), along with the number of scans. Entries are in no particular order.

POST /analytic-service/scans/users/get_levels
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
Example Response
{
  "from_date": "2000-01-01",
  "levels": [
    {
      "level": null,
      "scans": 11
    },
    {
      "level": "bronze",
      "scans": 115
    },
    {
      "level": "gold",
      "scans": 13
    }
  ],
  "to_date": "2100-01-01"
}

Top by Number of Scans

Top Products

Top products by number of scans. Response will contain products array of data points. Along with the number of scans each entry contain product information fields id (product GTIN), brand (product brand, or null if unspecified), name (product name). Entries are sorted by number of scans. Number of returned entries may be limited with the limit argument (10 by default).

POST /analytic-service/scans/products/get_top
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
limit number Limit the number of returned products
Example Response
{
  "from_date": "2000-01-01",
  "limit": 10,
  "products": [
    {
      "brand": "ABrand",
      "id": "00000093209403",
      "name": "Product A",
      "scans": 13
    },
    {
      "brand": "BBrand",
      "id": "00000093209403",
      "name": "Product B",
      "scans": 8
    },
    {
      "brand": "CBrand",
      "id": "00000093209403",
      "name": "Product C",
      "scans": 3
    }
  ],
  "to_date": "2100-01-01"
}

Top Users

Top users by number of scans. Response will contain users array of data points. Along with the number of scans each entry contain user information fields id (Shping user id), first_name, last_name, email, gender, level, age. Entries are sorted by number of scans. Number of returned entries may be limited with the limit argument (10 by default).

POST /analytic-service/scans/users/get_top
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count scans from date
to_date string Count scans to date
filter string Custom participant specific filtering e.g. {“field_a”:“some_value”}
limit number Limit the number of returned users
Example Response
{
  "from_date": "2000-01-01",
  "limit": 10,
  "to_date": "2100-01-01",
  "users": [
    {
      "age": null,
      "email": "xyz@foo.bar",
      "first_name": "Joe",
      "gender": null,
      "id": "urn:authenticateit:user:email:xyz@foo.bar",
      "last_name": null,
      "level": null,
      "scans": 11
    },
    {
      "age": 19,
      "email": "j@aaa.cn",
      "first_name": "Jane",
      "gender": "female",
      "id": "urn:authenticateit:user:email:j@aaa.cn",
      "last_name": "Xiang",
      "level": null,
      "scans": 8
    }
  ]
}

Spent Coins

Number of coins spent by participant's campaigns.

Reward campaigns may be filtered with the same set of parameters as in API to list reward campaigns. Filtering parameters are audience, events, start_date and end_date. Only coins spent by filtered campaigns will be accounted in the result.

Coins are reported in the smallest coin units, and represented either as integer or as a string of digits. To convert from the smallest coin units to coins, numbers should be divided by 10E18.

By Month

Number of coins spent by participant's campaigns, grouped by month. Response will contain months array of data points. Each entry contain year and month fields, along with the number of coins. Entries are ordered by year and month.

POST /analytic-service/spendings/get_months
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count spent coins from date
to_date string Count spent coins to date
audience JSON Filter campaigns by audience
events JSON Filter campaigns by events
start_date string Filter campaigns by start date
end_date string Filter campaigns by end_date
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "months": [
    {
      "year": 2017,
      "month": 4,
      "coins": 77000000
    },
    {
      "year": 2017,
      "month": 5,
      "coins": "8900000000000000000"
    }
  ]
}

By Week

Number of coins spent by participant's campaigns, grouped by week. Response will contain weeks array of data points. Each entry contain year and week (week number from 1 to 53) fields, along with the number of coins. Entries are ordered by year and week.

POST /analytic-service/spendings/get_weeks
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count spent coins from date
to_date string Count spent coins to date
audience JSON Filter campaigns by audience
events JSON Filter campaigns by events
start_date string Filter campaigns by start date
end_date string Filter campaigns by end_date
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "weeks": [
    {
      "year": 2017,
      "week": 3,
      "coins": 450000000
    },
    {
      "year": 2017,
      "week": 4,
      "coins": "33000000000"
    }
  ]
}

By Day

Number of coins spent by participant's campaigns, grouped by day of month. Response will contain days array of data points. Each entry contain year, month and day fields, along with the number of coins. Entries are ordered by the date.

POST /analytic-service/spendings/get_days
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count spent coins from date
to_date string Count spent coins to date
audience JSON Filter campaigns by audience
events JSON Filter campaigns by events
start_date string Filter campaigns by start date
end_date string Filter campaigns by end_date
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "days": [
    {
      "year": 2017,
      "month": 4,
      "day": 28,
      "coins": "1300000000000000"
    },
    {
      "year": 2017,
      "month": 5,
      "day": 3,
      "coins": "1500000000000000"
    },
    {
      "year": 2017,
      "month": 5,
      "day": 4,
      "coins": 50000000123
    }
  ]
}

Reward Indicators

Number of approved reward campaign events (impressions), number of all reward campaign events offered to users (issued), and number of coins spent for approved campaign events. All the numbers are for requested date range (from_date and to_date parameters). Response will contain num_impressions, num_issued and coins fields. The fields may be null if there is no data for the requested time period (e.g., from_date is in the future).

User must have rewards_admin role from a participant to access this endpoint.

Reward campaigns may be filtered with the same set of parameters as in API to list reward campaigns. Filtering parameters are audience, events, start_date and end_date. Only indicators related to the filtered campaigns will be included in the result.

POST /analytic-service/rewards/get_indicators
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Counting starting from date
to_date string Counting up to date
audience JSON Filter campaigns by audience
events JSON Filter campaigns by events
start_date string Filter campaigns by start date
end_date string Filter campaigns by end_date
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "num_impressions": 998,
  "num_issued": 131893,
  "coins": "432800000012315"
}

User Activities

List of scans made by users. The result is a JSON object with scans list of entries. Each entry contains scan information fields and user information in the field user.

The resulting entries may be filtered by date and time of the scan (from_date and to_date parameters), by scan information (scan parameter which is a JSON object) and by user information (user parameter, JSON object).

To get information on a particular scan with id "12345", send {"scan": {"id": "12345"}} as the request body. Only entries for this scan will be included in the result.

To filter activities by user profile use user parameter. It must be a JSON object with the following fields (all optional): country, language, city, gender, min_age, max_age, level. E.g., to get activities of male users from Melbourne older than 26 years, send {"user": {"gender": "male", "city": "Melbourne", "min_age": 27}}.

To get information on activities of a particular user with id "67890", send {"user": {"id": "67890"}}. Only entries related to this user will be included in the result.

Parameters offset and limit (both optional, having default values of 0 and 100) may be used for pagination.

To access this endpoint user must have report_viewer role from the system participant.

POST /analytic-service/scans/users/get_activities
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Filter entries by date range
to_date string Filter entries by date range
scan JSON Filter entries by scan data
user JSON Filter entries by user data
offset number Skip specified number of entries.
limit number Limit the number of returned entries.
Example Request
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "user": {
    "gender": "male",
    "city": "Melbourne",
    "min_age": 27
  }
}
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "scans": [
    {
      "accuracy": 65,
      "code": "00000026033419",
      "id": "4d4206e3-c70c-4c17-b87a-108863aaa10d",
      "latitude": 56838680,
      "longitude": 53245517,
      "coins": "1512311241411313",
      "status": {
        "icon": "not_recalled",
        "title": "Not recalled"
      },
      "ts": "2017-10-03T05:29:18Z",
      "user": {
        "birthdate": "1985-07-27",
        "city": "Melbourne",
        "country": "043",
        "email": "xyz@foo.bar",
        "first_name": "Jonh",
        "gender": "male",
        "id": "urn:authenticateit:user:email:xyz@foo.bar",
        "language": "en",
        "last_name": "Doe",
        "level": "platinum",
        "phone": null
      }
    }
  ]
}

Alerts

Alert entries in all alert methods may be filtered by date with from_date and to_date parameters.

The number of returned entries may be limited with limit parameter (100 by default). Number of entries specified with offset parameter (0 by default) will be skipped from the output.

All alert methods require report_viewer role from the system participant.

Number of Scans per Day

Maximum number of scans per day analytics. Returns list of alert entries in scans field. Each entry has date, scans (number of scans on that date), user (user who made all the scans). Entries are ordered by the number of scans in the scans field.

POST /analytic-service/alerts/get_scans_per_day
Parameters
Name Type Description
authenticateit_identity_ticket header Session's ticket (required)
from_date string Filter alert entries by date range
to_date string Filter alert entries by date range
country string Filter alert entries by country
city string Filter alert entries by city
offset 0.. Skip number of alert entries
limit 1.. Limit number of returned alert entries
Example Request

{
  "from_date": "2017-10-01",
  "country": "036",
  "limit": 5
}
Example Response
{
  "scans": [
    {
      "date": "2017-10-04",
      "scans": 35,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": "j.d@gmail.com",
        "first_name": "Jonh",
        "gender": null,
        "id": "urn:authenticateit:user:email:j.d@gmail.com",
        "language": "en",
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "date": "2017-10-04",
      "scans": 4,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": null,
        "first_name": "Jane",
        "gender": null,
        "id": "urn:authenticateit:user:facebook:12345678901234567",
        "language": null,
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "date": "2017-10-06",
      "scans": 2,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": "j.d@gmail.com",
        "first_name": "Jonh",
        "gender": null,
        "id": "urn:authenticateit:user:email:j.d@gmail.com",
        "language": "en",
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "date": "2017-10-05",
      "scans": 1,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": "j.d@gmail.com",
        "first_name": "Jonh",
        "gender": null,
        "id": "urn:authenticateit:user:email:j.d@gmail.com",
        "language": "en",
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "date": "2017-10-05",
      "scans": 1,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": null,
        "first_name": "Jane",
        "gender": null,
        "id": "urn:authenticateit:user:facebook:12345678901234567",
        "language": null,
        "last_name": "Doe",
        "level": "basic"
      }
    }
  ]
}

Number of Scans per Location

Maximum number of scans per location. Returns list of alert entries in scans field. Each entry has country, city, scans (number of scans in that location), user (user who made the scans). Entries are ordered by the number of scans in the scans field.

POST /analytic-service/alerts/get_scans_per_location
Parameters
Name Type Description
authenticateit_identity_ticket header Session's ticket (required)
from_date string Filter alert entries by date range
to_date string Filter alert entries by date range
country string Filter alert entries by country
city string Filter alert entries by city
offset 0.. Skip number of alert entries
limit 1.. Limit number of returned alert entries
Example Request

{
  "from_date": "2017-10-01",
  "country": "036",
  "limit": 5
}
Example Response
{
  "scans": [
    {
      "city": "Melbourne",
      "country": "036",
      "scans": 37,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": "j.d@gmail.com",
        "first_name": "Jonh",
        "gender": null,
        "id": "urn:authenticateit:user:email:j.d@gmail.com",
        "language": "en",
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "city": "Melbourne",
      "country": "036",
      "scans": 3,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": null,
        "first_name": "Jane",
        "gender": null,
        "id": "urn:authenticateit:user:facebook:12345678901234567",
        "language": null,
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "city": "Brighton",
      "country": "036",
      "scans": 1,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": null,
        "first_name": "Jane",
        "gender": null,
        "id": "urn:authenticateit:user:facebook:12345678901234567",
        "language": null,
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "city": null,
      "country": "036",
      "scans": 1,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": null,
        "first_name": "Jane",
        "gender": null,
        "id": "urn:authenticateit:user:facebook:12345678901234567",
        "language": null,
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "city": "Point Cook",
      "country": "036",
      "scans": 1,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": "j.d@gmail.com",
        "first_name": "Jonh",
        "gender": null,
        "id": "urn:authenticateit:user:email:j.d@gmail.com",
        "language": "en",
        "last_name": "Doe",
        "level": "basic"
      }
    }
  ]
}

Scans in Separated Locations

Pair of scans in separated locations in one day. Returns list of alert entries in separated_locations field. Each entry has scan1 (least recent scan in pair of separated scans), scan2 (most recent scan in pair of separated scans) and user (info on user who made these scans) fields. Scan objects in scan1 and scan2 fields have id (scan identifier), ts (date and time of the scan), city, country fields. Entries are ordered by scan timestamps from most recent to least recent.

Location filtering parameters country and city are not applicable to this API.

POST /analytic-service/alerts/get_separated_locations
Parameters
Name Type Description
authenticateit_identity_ticket header Session's ticket (required)
from_date string Filter alert entries by date range
to_date string Filter alert entries by date range
offset 0.. Skip number of alert entries
limit 1.. Limit number of returned alert entries
Example Request

{
  "from_date": "2017-10-01",
  "limit": 5
}
Example Response
{
  "separated_locations": [
    {
      "scan1": {
        "city": "Melbourne",
        "country": "036",
        "id": "8f8a77a0-f0b0-4b5e-bebd-b26eab9203a1",
        "ts": "2017-10-06T01:03:39Z"
      },
      "scan2": {
        "city": "Point Cook",
        "country": "036",
        "id": "17215e0b-255f-4926-8627-5e0fee01f648",
        "ts": "2017-10-06T08:26:56Z"
      },
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": "j.d@gmail.com",
        "first_name": "Jonh",
        "gender": null,
        "id": "urn:authenticateit:user:email:j.d@gmail.com",
        "language": "en",
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "scan1": {
        "city": "Melbourne",
        "country": "036",
        "id": "29297529-8267-4acb-aa40-58c15eb8baaa",
        "ts": "2017-10-04T08:24:30Z"
      },
      "scan2": {
        "city": "Brighton",
        "country": "036",
        "id": "75272506-6e7c-4eb3-96b2-b5b7212d55e1",
        "ts": "2017-10-04T10:29:09Z"
      },
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": null,
        "first_name": "Jane",
        "gender": null,
        "id": "urn:authenticateit:user:facebook:12345678901234567",
        "language": null,
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "scan1": {
        "city": "Melbourne",
        "country": "036",
        "id": "eb805398-102d-40e0-b7b6-ce4ce54be2d2",
        "ts": "2017-10-04T08:24:49Z"
      },
      "scan2": {
        "city": "Brighton",
        "country": "036",
        "id": "75272506-6e7c-4eb3-96b2-b5b7212d55e1",
        "ts": "2017-10-04T10:29:09Z"
      },
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": null,
        "first_name": "Jane",
        "gender": null,
        "id": "urn:authenticateit:user:facebook:12345678901234567",
        "language": null,
        "last_name": "Doe",
        "level": "basic"
      }
    }
  ]
}

Scan Time Difference

Time between consecutive scans by a user. Returns list of alert entries in time_diffs field. Each entry has scan1 (least recent scan in the pair of scans), scan2 (most recent scan in the pair of scans), time_diff (difference between time of scan1 and scan2 in seconds) and user (info on user who made these scans) fields. Scan objects in scan1 and scan2 fields have id (scan identifier) and ts (date and time of the scan) fields. Entries are ordered by scan time difference in time_diff field from small to large.

POST /analytic-service/alerts/get_scan_time_diff
Parameters
Name Type Description
authenticateit_identity_ticket header Session's ticket (required)
from_date string Filter alert entries by date range
to_date string Filter alert entries by date range
country string Filter alert entries by country
city string Filter alert entries by city
offset 0.. Skip number of alert entries
limit 1.. Limit number of returned alert entries
Example Request

{
  "from_date": "2017-10-01",
  "country": "036",
  "limit": 5
}
Example Response
{
  "time_diffs": [
    {
      "scan1": {
        "id": "4479a566-c251-4c56-881f-12888bac6872",
        "ts": "2017-10-04T06:39:39Z"
      },
      "scan2": {
        "id": "fad95807-3c01-4b04-b8c3-4f227f6109c1",
        "ts": "2017-10-04T06:39:42Z"
      },
      "time_diff": 3,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": "j.d@gmail.com",
        "first_name": "Jonh",
        "gender": null,
        "id": "urn:authenticateit:user:email:j.d@gmail.com",
        "language": "en",
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "scan1": {
        "id": "08f775bb-4e3a-4316-99a9-7fcb54f4302b",
        "ts": "2017-10-04T06:39:10Z"
      },
      "scan2": {
        "id": "d475fa81-18cc-41d0-bfe2-358452e1639c",
        "ts": "2017-10-04T06:39:14Z"
      },
      "time_diff": 4,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": null,
        "first_name": "Jane",
        "gender": null,
        "id": "urn:authenticateit:user:facebook:12345678901234567",
        "language": null,
        "last_name": "Doe",
        "level": "basic"
      }
    }
  ]
}

Reward Coins per Day

Number of reward coins earned per day by a user. Returns list of alert entries in coins field. Each entry has date, coins (number of reward coins earned on that day), user (info on user who earned the coins) fields. Entries are ordered by the number of coins in coins field, from bigger to smaller number of coins.

POST /analytic-service/alerts/get_coins_per_day
Parameters
Name Type Description
authenticateit_identity_ticket header Session's ticket (required)
from_date string Filter alert entries by date range
to_date string Filter alert entries by date range
country string Filter alert entries by country
city string Filter alert entries by city
offset 0.. Skip number of alert entries
limit 1.. Limit number of returned alert entries
Example Request

{
  "from_date": "2017-10-01",
  "country": "036",
  "limit": 5
}
Example Response
{
  "coins": [
    {
      "date": "2017-10-04",
      "coins": "7890000000",
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": "j.d@gmail.com",
        "first_name": "Jonh",
        "gender": null,
        "id": "urn:authenticateit:user:email:j.d@gmail.com",
        "language": "en",
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "date": "2017-10-05",
      "coins": 700000000,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": "j.d@gmail.com",
        "first_name": "Jonh",
        "gender": null,
        "id": "urn:authenticateit:user:email:j.d@gmail.com",
        "language": "en",
        "last_name": "Doe",
        "level": "basic"
      }
    },
    {
      "date": "2017-10-06",
      "coins": 220000000,
      "user": {
        "birthdate": null,
        "city": null,
        "country": "036",
        "email": "j.d@gmail.com",
        "first_name": "Jonh",
        "gender": null,
        "id": "urn:authenticateit:user:email:j.d@gmail.com",
        "language": "en",
        "last_name": "Doe",
        "level": "basic"
      }
    }
  ]
}

Email Alerts

Email alert methods require report_viewer role from the system participant.

Get Configuration

Current system analytics email alerts configuration. Returns JSON object containing fields email (list of alert recepient emails), coins_per_hour (threshold for reward coins per hour), rewards_per_hour (threshold for reward redemptions per hour), scans_per_hour (threshold for the number of scans per hour) and user_scans_per_hour (threshold for the number of scans per hour per user). Any threshold may be null if there is no threshold set for the metric.

GET /analytic-service/alerts/email
Parameters
Name Type Description
authenticateit_identity_ticket header Session's ticket (required)
Example Response
{
  "email": ["j.d@gmail.com", "xyz@foo.br"],
  "coins_per_hour": "10000000000000",
  "rewards_per_hour": 50,
  "scans_per_hour": null,
  "user_scans_per_hour": 50
}

Set Configuration

Update current system analytics email alerts configuration. Accepts JSON object which may contain fields email (possibly empty list of emails), coins_per_hour (threshold for the number of reward coins per hour), rewards_per_hour (threshold for the number of reward redemptions per hour), scans_per_hour (threshold for the number of scans per hour) and user_scans_per_hour (threshold for the number of scans per hour per user). Any threshold may be disabled by setting it to null. If the measured value becomes greater than the corresponding threshold, email will be sent to the addresses from the email field.

Response contains current configuration after the update.

PUT /analytic-service/alerts/email
Parameters
Name Type Description
authenticateit_identity_ticket header Session's ticket (required)
Example Request

{
  "email": ["j.d@gmail.com"],
  "coins_per_hour": null,
  "scans_per_hour": 5000
}
Example Response
{
  "email": ["j.d@gmail.com"],
  "coins_per_hour": null,
  "rewards_per_hour": 50,
  "scans_per_hour": 5000,
  "user_scans_per_hour": 50
}

ToDo card counts

Counters related to ToDo cards. The result is a JSON object with fields num_recipients (number of users who received ToDo cards), num_dismissed (number of dismissed ToDo cards) and num_completed (number of ToDo cards completed by users).

Parameters from_date and to_date may be used to count only cards, delivered in the time interval.

Parameter card_id may be used to restrict returned counters by specific ToDo card.

To access this endpoint user must have todo_cards_supervisor role from participant.

POST /analytic-service/todo_cards/get_counts
Parameters
Name Type Description
authenticateit_identity_ticket header Required: Session's ticket
from_date string Count cards after the date
to_date string Count cards before the date
card_id string Return counters for specific card
Example Request
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01"
}
Example Response
{
  "from_date": "2017-01-01",
  "to_date": "2018-01-01",
  "num_completed": 18,
  "num_dismissed": 192,
  "num_recipients": 1482
}

results matching ""

    No results matching ""