Can I send and receive custom data from TinCan LRS via the storyline

Sep 22, 2015

I have used below code for sending data when button clicking

var tincan = new TinCan (

            {

                url: window.location.href,

                activity: {

                    id: GolfExample.CourseActivity.id + "/Playing/Playing",

                    definition: {

                        name: {

                            "en-US": "TinCan-Sample"

                        },

                        description: {

                            "en-US": "An overview of the game of golf."

                        },

                        type: "http://activitystrea.ms/schema/1.0/page"

                    }

                }

            }

        );

 

        tincan.sendStatement(

            {

                verb: {

                    id: "http://adlnet.gov/expapi/verbs/experienced",

                    display: {

                        "en-US" : "Tican-Test"

                    }

                },

                context: GolfExample.getContext(

                    GolfExample.CourseActivity.id

                )

            },

            function () {}

        );

And used below code for receiving data when button clicking

var tincan = new TinCan ({url: window.location.href});

var statementFound = false;

var result = tincan.getStatements({

    sendActor: true,

    params: {

        verb: {

            id: "http://adlnet.gov/expapi/verbs/experienced"

        },

        activity: {

            id: "http://your-organizations.website/tincanapi/activities/unique-id-for-action"

        }

    },

    callback: function (err, result) {

        if (result.statements.length > 0) {

            statementFound = true;

             //Insert authoring tool specific code here.

        var statements = result.statements;

            var output = '';

            var name,verb,activity;

            for(var i=0;i<statements.length;i++){

              verb = statements[i].verb.display['en-US']; 

                alert(verb);

        alert(statements[i ].verb.id);

            }

        }

    }

});

Those data’s are stored in my sandbox but can’t store in TinCan LRS. I want to add and retrieve any custom data. Anybody to share some sample file to me, also my current output is attached here.

1 Reply

This discussion is closed. You can start a new discussion or contact Articulate Support.