Content Library API
The Content Library API returns data from your site's business info, text and images using Javascript. This article will walk you through how to use the API.
Usage
The Content Library API needs to be initialized before data can be accessed.
const contentLib = await dmAPI.loadContentLibrary();
Once initialized, different object properties can be accessed directly. In the example below, we are accessing the primary location's address and custom site texts.
//access different areas of the Content Library
const address = contentLib.location_data.address;
const customTexts = contentLib.site_texts.custom
customTexts.forEach((siteText) => {
console.log(`${siteText.label}: ${siteText.text}`)
})
Content Library Object
Property | Description |
---|---|
location_data object | Contains location-specific data for the primary location associated with a site. |
additional_locations object | Contains location-specific data for any secondary/child locations associated with a site. |
site_texts object | Contains the standard and custom text strings. Each field has a max length of 2000 characters. |
business_data object | Contains the name of the business and the primary image logo_url of the website. |
site_images object | Images that can be set and used within the design of the website. If you have the data, you should populate the alt value. |
Each of these object properties contains additional properties defined in the Content Library Object.
Updated 8 months ago