LPS Analytics API
March 7th, 2023
A REST API endpoint is created to measure LPS survey response.

It uses elastic search and aggregates to obtain doc_count for different states

entity_id, used for entity filter, is a mandatory param that must be passed along with access_token. Other params that can be used are
  1. start_date and end_date for the time filter.
  2. programme for Product filter. It accepts the value of Programme IDs(7, 8,9). 
  3. entity_type for Incoming or Outgoing products. Two available options for this filter are person and opportunity.
GET /v2/surveys/analytics.json

Sample request
https://analytics.api.aiesec.org/v2/surveys/analytics.json?access_token=<access_token>&start_date=<start_date>&end_date=<end_date>&entity_id=<office_id>&entity_type=<person/opportunity>&programme=<7,8,9>

Sample response
{
  "analytics": {
    "total_finished": {
      "doc_count": 5
    },
    "children": {
      "meta": {},
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": []
    },
    "total_detractors": {
      "meta": {},
      "doc_count": 1,
      "avg_nps_score": {
        "value": 2
      }
    },
    "total_promoters": {
      "meta": {},
      "doc_count": 1,
      "avg_nps_score": {
        "value": 9
      }
    },
    "total_responses": {
      "meta": {},
      "doc_count": 2,
      "avg_nps_score": {
        "value": 5.5
      }
    },
    "total_passives": {
      "meta": {},
      "doc_count": 0,
      "avg_nps_score": {
        "value": null
      }
    }
  }
}
X
Crafted by