drupal-7tin-can-apilrs

custom property in LRS & Tincan API


is it possible to add custom property to "Actor" via Tincan API to save it in LRS.

Detail: i am using Learning Locker as LRS system & Tincan API of Drupal & as its known there are 3 object inside the statement record that is saved in LRS which are [Actor - Verb - Object] now the Actor has 2 properties which are [name - mbox] and i tried to modify the Tincan module to add custom property which is [country] but the LRS API "Learning Locker" refused it. so is there a custom way to additional properties so that i can filter with later like [age - gender - country] or its standard API strict on the defined attributes

{
"version": "1.0.0",
"actor": {
    "objectType": "Agent",
    "name": "Creative User",
    "mbox": "mailto:register@example.com"
},
"verb": {
    "id": "http://adlnet.gov/expapi/verbs/action_custom_verb",
    "display": {
        "en-US": "action_custom_verb"
    }
},
"object": {
    "objectType": "Activity",
    "id": "http://localhost",
    "definition": {
        "name": {
            "en-US": "master"
        }
    }
},
"authority": {
    "objectType": "Agent",
    "name": "drupaladmin",
    "mbox": "mailto:hello@learninglocker.net"
},
"stored": "2017-02-06T16:58:23.625600+00:00",
"timestamp": "2017-02-06T16:58:23.625600+00:00",
"id": "9c1d552b-c825-4403-9c89-a9381b8d5320"

}


Solution

  • The standard API is strict with respect to the addition of properties. And the Agent/Group objects (which are what actor can contain) do not include the ability to expand their scope.

    Additional data points can be added in special properties called extensions that are available in a couple of places in the statement's objects. In this case you could use extensions in the context property's value to include your additional information about the actor. You could do this as single discrete pieces of information where each has its own extensions key, or you could use a single key that uses an object as its value and include individual pieces of information in properties of that object. For more information about extensions see: http://tincanapi.com/deep-dive-extensions/

    Note that extensions keys are not filterable via the /statements stream resource, so any querying based off of their key or value will have to be done through other means than the specification's API.