Public Method Author API

setActivityItems()

Sets the Items to be used in the Activity being edited. This overwrites the current Items in the Activity.

You would want to use this method so that you can programatically add default Items when a new Activity is created, for example.

If using Items from multiple Item banks for an Activity, you can set up an array of ItemBankDefinition as an entry in Activity edit's item_banks.

Examples

authorApp.setActivityItems(
    [
        {
            reference: "test1",
            organisation_id: 1
        },
        {
            reference: "test3",
            organisation_id: 1,
            item_pool_id: "pool_1"
        }
    ]
);

Arguments

  • items array[ItemObject]

    An array of Item references. Any reference that do not correspond to an existing Item in the Item bank is ignored.

Return value

boolean

Returns true if successful.

Returns false if unable to to set the Activity Items, for example, when not in the Activity editor view.

Type definitions

ItemBankDefinition object

An ItemBankDefinition describes from which sources Items can be loaded for an Activity. It is used as an entry in Activity edit's item_banks.

  • organisation_id number
    Specifies the organisation from which the Items are loaded.
  • item_bank_name string
    The name of the Item bank displayed by Author API.
  • item_pool_id string
    The ID of the Item pool from which Items are loaded.
  • filter object
    A specific filter for the Item bank. The object structure of the filter is the same as the Item search filter.

Related articles