Add a set of bookmarks to a web page 

Embed a set of bookmarks into your web pages. Your web application can use this resource to enable users to see and navigate to a selected set of bookmarks relevant to your web page.

Table 1. Atom API request details

Resource Description
/snippet Retrieves bookmarks matching search criteria. Returns JavaScript™ code that emits XHTML containing the search results, with each result specified in a <div> element.

Use one or more of the input parameters to narrow the search. Separate multiple parameters with an ampersand (&).

Table 2. Input parameters

Parameter Description
access Filters the bookmarks based on whether they are private or public. Options are:
any

    Returns all bookmarks only if the request is made over secure http (https). If the request is made over https, it is redirected to the /mybookmarks URI. If the request is made over http, only public bookmarks are returned. This value is the default value.

private

    Only returns private bookmarks. Private bookmarks can only be accessed by their owner, and only if the owner is authenticated. The user is prompted to log in and is redirected to the /mybookmarks URI from which only private bookmarks are returned.

public

    Only returns public bookmarks.

base Returns only bookmarks to pages hosted by a given web site. For example, to retrieve only bookmarks to pages on the web site www.w3c.org/TR, specify "base=www.w3.org/TR"
email Internet email address. Returns bookmarks created by the user specified by the email address. Format the HTTP request using the proper URL encoding. For example, the encoded form of the @ symbol is %40 as in:

adam_eventide%40garden.com

Note: Do not use this parameter if IBM Connections is configured to prevent email addresses from being displayed. Use the userid parameter instead.

lang Language code. Language for strings in the output. If not specified, the language specified by the first matching client, typically the web browser, is used, if available. The server then redirects the request to add this parameter to the URL. Specify this parameter to avoid the redirect.
network Filters the bookmarks based on the network that it is available from. Options are:

  • all – Default. Returns all bookmarks.

  • internet – Only returns the bookmarks that link to Internet resources, which are visible outside the intranet firewall.

  • intranet – Only returns the bookmarks that link to resources available on the corporate intranet, that is, resources that are not externally visible.

page Page number. Specifies the page to be returned. The default is 1.
ps Page size. Specifies the number of entries to return per page. Default 10. Maximum value allowed is 50.
search Well-formed full text search query. Performs a text search on the title, description, and tags of all bookmarks. Orders results by relevance. Respects other constraints. See Advanced search options in the Using section of the wiki for details on the search operators you can use in the search query to perform advanced searches for bookmarks.

Note: When you use this parameter, the search can only find bookmarks that the indexer has processed. The indexing interval is stored in a configuration property that your administrator can configure. See Manage search and index operations in the Administering section of the wiki for more details.

searchOperator Default operator between search terms. Options are:

  • and

  • or

The default value is set by your system administrator. Use in conjunction with "search" parameter to override the system default operator for search queries.

showFavIcon Includes links to bookmark icons (also known as "favorite icons") in the response. Bookmarks uses link relation "http://www.ibm.com/xmlns/prod/sn/icon" to identify this link in a bookmark Atom entry. Boolean. Options are:

  • false – Default. Links to bookmark icons are not included.

  • true – Includes links to bookmark icons.

since Includes in the resulting feed all bookmarks updated after a specified date. Specify the date using a date-time value that conforms to RFC3339. Use an upper case "T" to separate the date and time, and an uppercase "Z" in the absence of a numeric time zone offset. For example: 2009-01-04T20:32:31.171Z.
sort Specifies how the results should be sorted. Options are:

  • date – Default. Bookmark entries are sorted by the date they were created.

  • popularity – Bookmarks are sorted by popularity.

sortOrder Specifies the order the results should be sorted in. Options are:

  • asc – Default. Bookmarks are sorted in ascending order (oldest to newest, or least to most popular).

  • desc – Bookmarks are sorted in descending order (newest to oldest, or most to least popular).

tag Returns bookmarks with the specified tag. You can search for multiple tags; separate the tags with a space or comma. If you use a space, URL-encode the space using %20.
url A well-formed web address. Returns bookmarks for the given web address. When you use this parameter, all other search parameters are ignored.
userid Unique ID that represents a specific person.


Output

Content-Type: text/javascript. Indicates payload contains data in Javascript format.


Example

To add a current list of bookmarks matching the search criteria to a web page, add the following HTML code to the source code of your web page. This example uses the email parameter to qualify the search; you can use any of the search parameters listed above.

<script 
  language="javascript" type="text/javascript" 
  src="http://<yourcompany.com>/dogear/lisnippet?
   userid=<someuserid>&lang=en">
</script>

where <yourcompany.com> is the fully qualified domain name of the server hosting the Bookmarks application and <someuserid> is a valid user ID as defined in their <snx:userid> element.

The following sample HTML code adds unformatted bookmarks that have the "id" tag associated with them to a web page:

<html>
  <body>
    <h2>My documentation bookmarks</h2>
    <script language="javascript" type="text/javascript" 
      src="dogear.enterprise.example.com:9447/dogear/snippet?tag=id&lang=en">
    </script>
  </body>
</html>

The resulting page displays a bunch of unformatted documentation links.

If a new bookmark with a tag of "id" is added, and the page is refreshed, the list will be updated to show the newly added bookmark as well.

You can change the appearance of the bookmarks that are returned by applying a style defined in the cascading style sheet to them. This example applies the style defined for the dogeartags class to the resulting bookmarks.

<div class="dogearlinks">
  <div class="dogearlink">
    <a href="http://sampleurl.com/" title="Description of URL">
     Title of URL
    </a>
    <br />
    <span class="dogearperson">Firstname&nbsp;Lastname</span>
    <span class="dogeartags">
        <a href="http://url.of.tag1">tag1</a>
        <a href="http://url.of.tag2">tag2</a>
        <a href="http://url.of.tag3">tag3</a>
    </span>
  </div>
</div>


Parent topic

Extending bookmarks

Related concepts
Advanced search options
Manage the Search index

Related reference
Add popular bookmarks to a web page


   

 

});

+

Search Tips   |   Advanced Search