Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/bookmarks/get/index.md
6567 views
------{{AddonSidebar()}}
Given the ID of a {{WebExtAPIRef("bookmarks.BookmarkTreeNode")}} or an array of such IDs, the bookmarks.get() method retrieves the matching nodes.
This is an asynchronous function that returns a Promise.
Syntax
Parameters
idOrIdList:
stringA {{jsxref("string")}} or {{jsxref("array")}} of strings specifying the IDs of one or more {{WebExtAPIRef("bookmarks.BookmarkTreeNode", "BookmarkTreeNode")}} objects to retrieve.
Return value
A Promise that will be fulfilled with an array of BookmarkTreeNode, one for each matching node. Separators are not included in the results. If no nodes could be found, the promise will be rejected with an error message.
Examples
This example tries to get the bookmark whose ID is bookmarkAAAA. If no bookmark with this ID exists, onRejected is called:
{{WebExtExamples}}
Browser compatibility
{{Compat}}
Note: This API is based on Chromium's
chrome.bookmarksAPI. This documentation is derived frombookmarks.jsonin the Chromium code.