Returns a ResourceList of top level collections, subcollections of the specified parent_collection_id, or collections that match the specified query string. The default is the first 20 collections, but appending .all() returns a representation of all matching collections. You can iterate over a ResourceList as you would a list.

The examples below demonstrate how to use .all() and list slicing to obtain the collections you want.

Required arguments


Optional keyword arguments

string Returns only collections that match the specified attribute (currently display_name is the only attribute supported by this parameter). For example, setting filter to display_name=Companies returns only collections named “Companies”; display_name<G returns only collections with names with first letter less than ‘G’. You cannot combine this with the query parameter.
array Returns only collections tagged with the specified tag name (for example, construction or real%20estate). If you specify multiple tags, the API returns collections with any of the tags (OR).
string Works in conjunction with query and returns only collections within the specified collection.
string Values: advanced phrase simple
Defaults to simple.
string Returns only collections whose immediate parent collection ID matches the one specified.
integer If mode is phrase, this specifies the proximity search distance. For example, if query is sovereign%20country and phrase_distance=0, the two words must be next to each other. If phrase_distance=1, it also matches 'sovereign island country'.
string Returns only collections that include the specified text in the collection metadata. You cannot combine this with the filter parameter.
string The collection attribute to sort the results by (defaults to display_name).


A ResourceList of collection models.

If you append a list slicing operator ([]), the SDK returns a Python generator. You can iterate over a generator as you would a list.


Example 1 returns all top level collections (or the first 20 if there are more than 20).

public = enigma.Public()
collections = public.collections.list()

Example 2 returns the first, third, fifth, seventh, and nineth child collections (by display name) for the specified parent collection.

parent_id = 'bf068aa3-a15c-4db3-bdb1-6d51f91eae5a'
collections = public.collections.list(parent_collection_id=parent_id)[0:10:2]

Example 3 returns all collections that include the phrase “federal reserve”.

collections = public.collections.list(query='"federal reserve"').all()