User Tools

Site Tools


api2:data:event

Once all the management layers and knowledge’s structure are declared, you can start registering all your student’s data and retrieve their statistics on our API. Hence, you can declare Event objects and manage them. For instance, if you need to store results, you can declare an Event object with a EventResult type.
The only constraint for the consolidation feature is that you must register your Event as EventReview type and the payload should be either “0” or “100”. For the adaptive learning functionality, the more types we have and the more precise is the payload, the more accurate we are doing recommendations.

 Event

Object resources

Property Type Description
id Integer identifier for the database of Domoscio's API
event_type Text The type of this Event object. “EventResult”, “EventRead” or “EventReview”
student_id Integer Student identifier
content_id Integer The content identifier
return_recommendation Boolean If true, the system computes and sends backs recommendations, otherwise computes and does not send
generated_at DateTime Time at which the event has been done
payload Text The payload of this event indicates the sucess or fail of the student for this event
standard String standard used to declare the payload
created_at DateTime Date of creation of the object
updated_at DateTime Last time the object has been modified
Note concerning the payload

You can have several types of payloads.

  1. the first one is a classic score between 0 and 100. The standard is then “score”, and a payload of 100 indicates success while a payload of 0 indicates a failure.
  2. the second is the xAPI norm. In that case, the standard is “xAPI”, and the payload has the following form:
{
   "actor"=>{"objectType"=>"Agent", "name"=>"Evan Friburg", "mbox"=>"mailto:test@mail.com", "account"=>{"name"=>"32", "homePage"=>"https://stats-engine.domoscio.com/v2/instances/1/students/32"}},
   "verb"=>{"id"=>"http://adlnet.gov/expapi/verbs/scored"}, 
   "object"=>{"id"=>"cell_tests/28", "definition"=>{"name"=>{"en-US"=>"test 1"}, "description"=>{"en-US"=>"<p>Que repr&eacute;sente pour vous ce mnemos ? pessimisme</p>\r\n<p><img src=\"https://pure-mesa-4658.s3.amazonaws.com/uploads/ckeditor/pictures/31/content_cote_obscur.png\" alt=\"\" width=\"469\" height=\"552\" /></p>"}, "type"=>"http://adlnet.gov/expapi/activities/question"}}, 
   "result"=>{"score"=>{"scaled"=>0}}, 
   "timestamp"=>"2017-10-05T16:28:26+00:00", 
   "id"=>"2aa13d13-671e-408a-a0f7-d85ebfcc9835", 
   "version"=>"1.0.1"
}
Note concerning the event_type

An EventResult is created when the learner answers a question in a learning objective, as opposed to an EventReview, where the learner answers a question in a reviewing objective. An EventRead is created when the learner interacted with a “Learning”-tagged content in order to learn a new concept. If you are in any of these cases, you can use an EventBlank.

Create (POST)

Method POST
URL /events
Parameters (*Requiered parameters)
Property Type Description
event_type* Text The type of this Event object. “EventResult”, “EventRead” or “EventReview”
student_id or student_uid * Integer Student identifier
content_id or content_uid * Integer The content identifier
return_recommendation Boolean If true, the system computes and sends backs recommendations, otherwise computes and does not send
generated_at DateTime Time at which the event has been done. If empty, it is replaced by the Time of creation
payload* Text The payload of this event indicates the sucess or fail of the student for this event
standard* String standard used to declare the payload
Send the request (JSON input example)
{ 
  "student_id": 379,
  "content_id": 2749,
  "payload": 100,
  "standard": "score",
  "return_recommendation": "false",
  "event_type": "EventResult",
  "generated_at": "2017-11-27T11:17:57+00:00"
}
Get the response (JSON output example)
{
    "id": 559,
    "event_type": "EventResult",
    "payload": 100,
    "created_at": "2017-11-27T13:34:18.977Z",
    "updated_at": "2017-11-27T13:34:18.977Z",
    "student_id": 379,
    "content_id": 2749,
    "content_uid": "question1",
    "generated_at": "2017-11-27T11:17:57.000Z",
    "return": true,
    "standard": "score"
}

Fetch (GET)

Method GET
URL /events

If no event_id is provided it will fetch all the Events for your instance. You can choose to add the parameters student_id, content_id, knowledge_node_id, event_type, date_start (all the events after that date), date_end (all the event before that date), or event_type.

Get the response (JSON output example)

With ID provided

{
    "id": 560,
    "event_type": "EventResult",
    "payload": 100,
    "created_at": "2017-11-27T13:36:39.601Z",
    "updated_at": "2017-11-27T13:36:39.689Z",
    "student_id": 379,
    "content_id": 2749,
    "content_uid": "question1",
    "generated_at": "2017-11-27T11:17:57.000Z",
    "return": true,
    "standard": "score"
}

Without ID provided

[
    {
        "id": 447,
        "event_type": "EventReview",
        "payload": 100,
        "created_at": "2017-09-20T14:35:45.143Z",
        "updated_at": "2017-09-20T14:35:45.149Z",
        "student_id": 267,
        "content_id": 710,
        "content_uid": null,
        "generated_at": "2017-09-20T14:35:45.143Z",
        "return": null,
        "standard": null
    },
    {
        "id": 448,
        "event_type": "EventReview",
        "payload": 0,
        "created_at": "2017-09-20T14:35:45.181Z",
        "updated_at": "2017-09-20T14:35:45.189Z",
        "student_id": 267,
        "content_id": 709,
        "content_uid": null,
        "generated_at": "2017-09-20T14:35:45.181Z",
        "return": null,
        "standard": null
    }
]

Fetch Events by Student (GET)

Instead of using event_id to retrieve related data, you can fetch all Events for a given Student.

Method GET
URL students/{student_id}/events
api2/data/event.txt · Last modified: 2018/07/31 16:50 by maries