fetchItems - Methods - Author API

Author API Methods

fetchItems()

Performs a search using the provided search parameters.

You would want to use this method to build a custom Item search feature in your application, for example.

Note This method does not return full Item JSON. It returns a subset of Item data used to render the Item list view.

Note If you just want to retrieve the list of Items in the Item list view, use the getItemList() method instead.

Examples

var searchParameters = {
    "content": "content",
    "filterByWorkflowStates":true,
    "limit": 40,
    "reference": "4823",
    "sort": "desc",
    "sort_field": "updated",
    "status": ["published"],
    "tags": {
        "all": [
            {
                "type":"Subject",
                "name":"English"
            }
        ]
    },
    "widgetType": "mcq"
};
var itemsPromise = authorApp.fetchItems(searchParameters);

itemsPromise.then(response => {
    console.log(response);
});

/*
[
    {
        "note": "",
        "dt_updated": "2025-12-01 12:09:55",
        "item_id": "321719096",
        "dt_created": "2025-06-01 11:49:50",
        "title": "My Item title",
        "created_by": {
            "last_name": "Site",
            "id": "help-site",
            "first_name": "Help",
            "email": "helpsite@learnosity.com"
        },
        "tags": [
            {
                "name": "English",
                "type": "Subject"
            }
        ],
        "reference": "1ba18b07-4823-4e78-aea7-4729111a24d3",
        "authoring_workflow": {
            "state": "unassigned"
        },
        "status": "published",
        "organisation_id": 6,
        "content": ""
    },
    { ... },
    ...
]
*/

Arguments

  • searchParameters object

    Object containing search parameters to filter the search results by.

    Use any combination of the available properties to filter the search results.

    The following properties are supported.

    • content string

      Filters Items by whether their content contains the provided text.

    • limit number

      The maximum number of Items to return.

      Default: 100

    • filteredWorkflowState string

      Filters Items by a specific workflow state.

      Important This property can only be used when the config.global.workflow initialization option is configured.

      Possible values

    • filterByWorkflowStates boolean

      If set to true, filters results by workflow states (authoring workflow).

      Important This property can only be used when the config.global.workflow initialization option is configured.

    • reference string

      Filters Items by reference. Supports partial matching, between 3 and 12 characters.

    • sort string

      Sort direction.

      Default: "desc"

      Possible values

      • "asc"
      • "desc"
    • sort_field string

      Field used for sorting.

      Default: "updated"

      Possible values

    • status array[string]

      Filters results by Item status.

      Default: ["published", "unpublished"]

      Possible values

      • "published"
      • "unpublished"
      • "archived"
    • tags array[tagsV2]

      Filters results by Tags.

    • title string

      Filters Items by title. Supports partial matching, between 3 and 12 characters.

      Important This property can only be used when the config.item_list.item.title.show initialization option is set to true.

    • widgetType string

      Filters results by Widget type (Question type), such as "mcq".

      Possible values

Return value

Type Promise

When the promise resolves, it returns an array of up to 100 objects (unless a custom limit is provided). Each object contains data for one row of the Item list data; This includes the Item reference, title, status, and other metadata like time created, time updated, author, etc.

If it runs successfully, it will return an array of the Item JSON(s) in the Item list.

Returns false if not in the Item list view.

Was this article helpful?

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