Skip to content

How to use SDKs and APIs for Bookmarks

What are Bookmarks?

Bookmarks are part of Audience Insights that enable users to easily bookmark and save content for later. Bookmarks are directly tied to content via the ANS ID, ensuring precise tracking and retrieval.

It can also be implemented as standard PageBuilder blocks to deliver a lightweight save-for-later experience.

How can I implement Bookmarks on my site?

We provide a set of APIs and SDK methods that allow you to connect your end users with our system.

To interact with our system, you can either call the APIs directly or use our SDK packages. Our SDK methods act as wrappers that help developers interact with our APIs more easily.

We strongly recommend using our SDKs, as these libraries handle various tasks for you, including authentication.

Authentication and Authorization

For tracking user calls and accessing protected public APIs, most of our public APIs requires an access token. This access token is in JWT (JSON web tokens) format and is returned after the user is logged in to the system.

See here for more: Connect and log in with Arc XP Identity SDKs and APIs on the web

When the user logs in, two JWTs are returned if the request is successful:

  • Access token: This token has a limited lifetime (15 minutes by default) and identifies the user. It must be passed as a Bearer token in the protected request.

  • Refresh token: This token is used to refresh and obtain a new access token when the old one expires. You can customize the lifetime of the refresh token through the CSR tool.

You must pass the access token in the Authorization header as a Bearer token when making API calls that require authentication. It is recommended that you use the browser SDKs when possible, as they will handle token expiration and refreshing automatically.

Using Bookmarks on your site with the Audience Insights SDK

For more information and example code on how to implement Bookmarks in PageBuilder, refer to Bookmarks recipe in https://github.com/arcxp/audience-insights-examples.

The Bookmarks & Bookmarks list examples linked in that repo demonstrates how to use the Audience Insights SDK for two usecases:

  1. Adding a Bookmark button to articles that allows users to save articles for later reading.
  2. Displaying a list of saved Bookmarks for the logged-in user.

Using Bookmarks on your site or app with the public APIs

Terminal window
curl --location 'https://{ApiOrigin|CDN}/identity/public/v2/extprofile/readlater' \
--header 'Authorization: Bearer {access_token}'

All available public APIs are documented in our Audience Insights OpenAPI documentation. You can identify these APIs by the presence of /identity/public/v2/extprofile/ in the endpoint URL. The APIs do require authentication, you must pass a valid access_token (Authorization header). Ensure the access token is valid before making the API call.

Example: Authentication required

Terminal window
curl --location 'https://{ApiOrigin|CDN}/identity/public/v2/extprofile/readlater' \
--header 'Authorization: Bearer {access_token}'

For more information about the available APIs, see Audience Insights APIs

Arc XP Audience Insights Bookmarks SDKs and APIs

As mentioned earlier, our SDK methods serve as wrappers, making it easier for developers to interact with our APIs. The following table lists the Sales SDK methods and the corresponding APIs they wrap.

SDK MethodAPI
addBookmark(ansId)POST /identity/public/v2/extprofile/readlater
listBookmarks()GET /identity/public/v2/extprofile/readlater
deleteBookmark(ansId)DELETE /identity/public/v2/extprofile/readlater/{ansId}