# bloomreach-content-management-apis

> A library of functions for calling Bloomreach Content SaaS Management APIs

Latest version **1.3.0** (published 2024-09-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install bloomreach-content-management-apis
pnpm add bloomreach-content-management-apis
yarn add bloomreach-content-management-apis
bun add bloomreach-content-management-apis
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2024-09-18 |
| First published | 2023-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 343.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Adam Pengh |
| Maintainers | apengh |
| Keywords | bloomreach, content management |

## Links

- npm: https://www.npmjs.com/package/bloomreach-content-management-apis
- Repository: https://github.com/adampengh/bloomreach-content-management-apis
- Homepage: https://github.com/adampengh/bloomreach-content-management-apis#readme
- Issues: https://github.com/adampengh/bloomreach-content-management-apis/issues
- npm.io page: https://npm.io/package/bloomreach-content-management-apis

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^1.7.7

## Recent versions

- 1.3.0 (latest) — 2024-09-18
- 1.2.1 — 2024-04-25
- 1.2.0 — 2024-03-04
- 1.1.0 — 2023-12-16
- 1.0.3 — 2023-10-23
- 1.0.2 — 2023-10-23
- 1.0.1 — 2023-10-23
- 1.0.0 — 2023-10-20

## README

# Bloomreach Content Management APIs

This library provides a collection of functions for interacting with the [Bloomreach Content Management APIs](https://documentation.bloomreach.com/content/reference/management-apis)
for JavaScript-based applications.

## Get Started

### Installation

To get the package into your project with [NPM](https://docs.npmjs.com/cli/npm):

```bash
npm install bloomreach-content-management-apis
```

And with [Yarn](https://yarnpkg.com):

```bash
yarn add bloomreach-content-management-apis
```

## Reference

Typedoc for the Bloomreach Content Management APIs is automatically generated and published
to https://adampengh.github.io/bloomreach-content-management-apis/modules.html

### Usage

The following code snippet demonstrates how to copy a component from one CMS environment to another

```javascript
import { getComponent, putComponent } from 'bloomreach-content-management-apis';

const compontentGroup = 'brx-reference-spa';
const componentName = 'referencespa-content';

// Source environment variables
const source = {
  environment: 'test-customer',
  xAuthToken: '12345678-1234-1234-1234-123456789010',
  channelId: 'reference-spa-v1a2B'
}

// Target environment variables
const target = {
  environment: 'customer',
  xAuthToken: 'abcdefgh-abcd-abcd-abcd-abcdefghijkl',
  channelId: 'reference-spa-vA1b2'
}

/**
 * Check if component exists in Target CMS Environment/Channel
 */
const xResourceVersion = await getComponent(
  target.environment,
  target.xAuthToken,
  target.channelId,
  componentGroup,
  componentName
)
  .then(response => {
    console.log('Check for Existing Component Success', response.headers)
    return response.headers['x-resource-version']
  })
  .catch(error => console.error('Get Component Error', error.message))

/**
 * Get component configuration from Source CMS Environment/Channel
 */
const componentData = await getComponent(
  source.environment,
  source.xAuthToken,
  source.channelId,
  componentGroup,
  componentName
)
  .then(response => {
    console.log('Get Component Success', response.data)
    return response.data
  })
  .catch(error => console.error('Get Component Error', error))

/**
 * Put component configuration in Target CMS Environment/Channel
 */
if (componentData) {
  await putComponent(
    target.environment,
    target.xAuthToken,
    target.channelId,
    componentGroup,
    componentName,
    componentData,
    xResourceVersion
  )
    .then(response => console.log('Put Component Success'))
    .catch(error => console.error('Put Component Error', error))
}
```

## License

Published under the [MIT](https://opensource.org/license/mit/) license.

---
_Source: https://npm.io/package/bloomreach-content-management-apis · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
