Skip to content
For AI agents: the complete documentation index is available at llms.txt; this page is also available as Markdown at index.md.

Bookmark API

BookmarkService enables you to add and remove content from favourites, and read favourite assignments.

Bookmark REST API

To learn how to manage favourites using the REST API, see REST API reference.

To view a list of all favourites, use BookmarkService::loadBookmarks:

1
2
3
4
5
6
7
$bookmarkList = $this->bookmarkService->loadBookmarks();

$output->writeln('Total favourites: ' . $bookmarkList->totalCount);

foreach ($bookmarkList->items as $bookmark) {
    $output->writeln($bookmark->getContentInfo()->name);
}

You can mark a content item as favourite by providing its Location object to the BookmarkService::createBookmark method:

1
2
3
$location = $this->locationService->loadLocation($locationId);

$this->bookmarkService->createBookmark($location);

You can remove a location from a list of favourites with BookmarkService::deleteBookmark:

1
$this->bookmarkService->deleteBookmark($location);