getActivity - Methods - Author API

Author API Methods

getActivity()

Obtains the JSON for the current Activity being edited.

You would want to use this method so that you can make changes to the current Activity programmatically, for example.

Important This method can only be used when in the Activity editor view, when the mode initialization option is set to "activity_edit".

Examples

var activity = authorApp.getActivity();
console.log(activity);

/* Returns:
{
    "reference": "test",
    "description": "test",
    "data": {
        "items": [
            {
                reference: "test1",
                organisation_id: 1
            },
            {
                reference: "test3",
                organisation_id: 1,
                item_pool_id: "pool_1"
            }
        ],
        "rendering_type": "assess"
    },
    "status": "published",
    "dt_created": "2017-05-22 05:01:21",
    "dt_updated": "2017-05-30 07:04:26",
    "last_updated_by": "639",
    "tags": [],
    "adaptive": {
        "difficulty": null,
        "operational_exposure": null,
        "seeding_exposure": null
    },
    "tagsCount": 0,
    "content": "",
    "rendering_type": "assess"
}
*/

Arguments

None.

Return value

Type activityTemplate | boolean

Returns the JSON object which contains all of the current settings and content (activityTemplate) for the current Activity being edited.

This method can only be executed in the context of the Activity editor, otherwise it will return false.

Type definitions

  • activityTemplate object

    All of the settings and content for the Activity.

    • adaptive object

      See the adaptive Items API initialization option which contains the configuration for an adaptive assessment.

    • data activityJson

      The content for the Activity consisting of Items and other assessment content.

    • description string

      The description of the Activity entered by the author.

    • dt_created string

      Date and time when the Activity was created.

    • dt_updated string

      Date and time when the Activity was last updated.

    • reference string

      The Activity reference used to identify the Activity.

    • status string

      The current workflow state for the Activity, for example, published, unpublished, or archived.

    • tags array[tagsV2]

      Array of tagsV2 objects corresponding to Tags associated with the Activity.

    • tagsCount number

      Number of Tags associated with the Activity.

  • activityJson object

    Definition of the Activity JSON.

    • config object

      The Items API initialization options. See the Items API initialization options for more information.

    • items array[ItemObject]

      An array of ItemObject references to be used in the Activity.

    • rendering_type string

      The Items API rendering type for the assessment, which can be rendered inline or using the assessment player.

  • tagsV2 object

    Tags are used to improve searching for content while authoring and for reporting and analytics purposes.

    See Understanding Tag Formats for Content Creation and Filtering for more information.

    • name string

      The Tag name.

      Maximum length is 255 characters.

    • type string

      The Tag type.

      Maximum length is 255 characters.

Related articles

  • The setActivity() method, which allows you to set the Activity JSON.
Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.