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"
};
authorApp.fetchItems(searchParameters).then(response => {
    console.log(response);

    // Fetch the next page with the same search parameters
    if (response.next) {
        return authorApp.fetchItems({ ...searchParameters, next: response.next });
    }
});

/*
{
    "items": [
        {
            "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": ""
        },
        { ... },
        ...
    ],
    "next": [1764590995000, 321719096]
}
*/

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.

    • 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.

    • 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

    • limit number

      The maximum number of Items to return.

      Default: 100

    • next array string

      Specifies the pagination cursor used to fetch the next page of results.

      Pass the next value from the previous response back unchanged, with all other search parameters unchanged, to fetch the following page.

      Omit this property to retrieve the first page, and whenever any other search parameter changes.

      Pagination cursor in string form, returned by some data sources. Handle it in the same way as the array form: pass it back unchanged.

      Note Depending on the data source, the cursor is an array or a string. Treat it as an opaque value: do not parse, modify or construct it.

      Important If any other search parameter changes (for example, a filter, sort or sort_field), omit next to start again from the first page. The cursor marks a position in the sort order and does not record the search parameters that produced it, so reusing it with different parameters returns the wrong page rather than an error.

    • 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 object

      Filters results by Tags.

      The following properties are supported.

      • all array[object]

        Filters Activities that have all of the specified Tags.

      • either array[object]

        Filters Activities that have at least one of the specified Tags.

      • none array[object]

        Filters Activities that have none of the specified 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

The promise resolves with an object that has the following properties:

  • items - an array of Item list rows, up to limit (maximum 100). Each object contains data for one row of the Item list, including the Item reference, title, status, and other metadata such as time created, time updated and author.
  • next - a pagination cursor. Pass it back in searchParameters to fetch the next page. It is present only when the page is full, that is, when it contains limit rows. If it is missing, there are no more results. If the total number of results is an exact multiple of limit, the last request returns an empty items array.

The promise rejects with false if the request fails.

Was this article helpful?

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