Use the chrome.bookmarks API to create, organize, and otherwise manipulate bookmarks.

Description

[PENDING: intro goes here...]

Bookmark objects are an important part of the chrome.bookmarks API. Each bookmark object represents either a URL or a group of bookmarks, as you can see in the following figure.

2 kinds of bookmark objects

Properties

Objects that represent bookmarks can have the following properties:

id
An integer ID that's unique for each bookmark. Don't save this ID in persistent storage; the ID for a particular bookmark might change the next time the browser is started.
title
The name of the bookmark. This is the user-visible string that describes the URL or group.
parentId (omitted for the root group)
The ID of the group that this bookmark is in.
index (optional; omitted for the root group)
The 0-based integer position of the bookmark within its group.
url (omitted for groups)
The URL of the page that the bookmark points to.

Examples

The following code creates a bookmark group with the title "Chromium bookmarks". The last argument defines a function to be executed after the folder is created.

chrome.bookmarks.create({'parentId': bookmarkBar.id,
                         'title': 'Chromium bookmarks'},
                        function(newFolder) {...});

The next snippet creates a bookmark pointing to the Chromium developer doc. Since nothing too bad will happen if creating the bookmark fails, this snippet doesn't bother to define a callback function.

chrome.bookmarks.create({'parentId': chromiumBookmarks.id,
                         'title': 'dev doc',
                         'url': 'http://dev.chromium.org'});

Say you have bookmark hierarchy that looks like this:

Here's how those bookmarks might be represented with bookmark objects:

a hierarchy of bookmarks

Here's some code you could use to create that hierarchy:

...code goes here...