User-score export resources

Trigger user-score export

Allows to trigger an export as txt/csv file containing a list of user-scores with their gamification scores at the start and at the end of a given period. Gamification needs to be enabled and the user requires the User Statistics Admin role.

Important: The start and end point of the export are always at midnight UTC. When defining the start and end, you can use any ISO8601 format. However, any time and time zone specifications will be ignored and only the date will be considered. E.g. using "start": "2015-01-01T00:00:00.000+01:00" will put the start date on the 1st of January, even though this timestamp is actually on the 31st of December in the UTC timezone.

POST /export/user-scores
Parameter Type Default Required Description
start_date date Gamification start date Start of the period (inclusive)
end_date date Current date End of the period (inclusive)

Response

The request will be returned, immediately. The export is running in the background.

{
    "export_id": 4,
    "start_date": "2018-07-30T16:39:19.000Z",
    "file_size": null,
    "user_id": 1,
    "end_date": null,
    "filename": "starmind_user_scores_export-234412.csv",
    "count": null,
    "status": "processing",
    "message": null
}

Available exports

Returns all user-scores exports for the network. A finished export is indicated with status: "success".

GET export/user-scores

Response

[
    {
        "export_id": 1,
        "start_date": "2018-07-30T16:10:19.000Z",
        "file_size": null,
        "user_id": 1,
        "end_date": null,
        "filename": "network_user_scores_export_inactive_20180730-161019.csv",
        "count": null,
        "status": "processing",
        "message": null
    },
    {
        "export_id": 2,
        "start_date": "2018-07-30T16:13:22.000Z",
        "file_size": 1129207,
        "user_id": 1,
        "end_date": "2018-07-30T16:13:44.000Z",
        "filename": "network_user_scores_export_20180730-161322.csv",
        "count": 32103,
        "status": "success",
        "message": null
    },
    {
        "export_id": 3,
        "start_date": "2018-07-31T12:00:00.000Z",
        "file_size": null,
        "user_id": 1,
        "end_date": null,
        "filename": "network_user_scores_export_20180731-120000.csv",
        "count": null,
        "status": "error",
        "message": "Error occurred"
    }
]

Export

Returns a user-score export by ID. Each export can have following states:

"success", "processing", "error".

If a user-score export is in status "success", the file_size (bytes), count (number of exported users with scores) and end_date will be provided, additionally.

GET export/user-scores/:ID

Response

{
    "export_id": 2,
    "start_date": "2018-07-30T16:13:22.000Z",
    "file_size": 1129207,
    "user_id": 1,
    "end_date": "2018-07-30T16:13:44.000Z",
    "filename": "network_user_export_20180730-161322.csv",
    "count": 32103,
    "status": "success",
    "message": null
}

Export download

Returns a csv file containing the user-score export. Content-Type: txt/csv, Encoding: UTF-16LE, with the following columns:

id, first name, last name, email, interface language, gender, country, location, company, department, position, start_date, end_date, start_points, start_level, end_points, end_level

Please note that fields are TAB separated.

All datetime columns (start_date, end_date) are formatted according to the pattern yyyy-MM-dd HH:mm:ss and are always in timezone UTC+00.

GET export/user-scores/:ID/file

Response

network_user_scores_export_20180730-161322.csv