Skip to content

Fetching Data

Data model description

In the HappyOrNot-system customers’ organizational aspects are structured hierarchically in a tree of folders. These folders are used to represent abstract and physical locations, business areas, stores and offices, etc. Folders can contain surveys that determine when a certain question is used and how the collected feedback is displayed. So the HappyOrNot feedback results are available via surveys.

Fetching results

Results can be fetched per survey object by its identifier and optional parameters that control result set precision and time period. To get survey identifiers, you first have to call the folders resource with parameter ‘surveys’ set to ‘true’. The response contains a list of folder objects with an array of surveys if any have been assigned to the folder. Note that only leaf level folders can contain surveys. The survey’s identifier is its property key.

Example of how to fetch results
Fetch surveys of a folder:
https://api.happy-or-not.com/v1/folders?surveys=true
Response
{
  "key": 123,
  "name": "ExampleRootFolder",
  "folders": [
    {
      "key": 124,
      "name": "ExampleSubFolder1",
      "surveys": [
        {
          "key": 1234,
          "question": {
            "key": 12345,
            "name": "How was your day?",
            "locale": "en-US"
          },
          "timeZone": "UTC",
          "activePeriods": [
            {
              "start": "2016-01-01T00:00:00.000Z",
              "end": "2017-01-01T00:00:00.000Z"
            }
          ],
          "surveyType": "TERMINAL"
        }
      ]
    }
  ]
}
Fetch results for survey 1234
https://api.happy-or-not.com/v1/surveys/1234/results
Response
[
  {
    "ts": "2016-06-01T00:00:00.000Z",
    "data": [4, 8, 12, 16]
  },
  {
    "ts": "2016-05-02T00:00:00.000Z",
    "data": [7, 5, 23, 37]
  }
]