Skip to content

Access CaaS Upstream API

The FirstSpirit Connect for Commerce Frontend API provides a facade to simplify the most common use cases for connecting storefronts with a CaaS. Nevertheless, for even more advanced projects, it is possible to access the raw data from CaaS and utility functions to apply as much customization as needed, directly on the backend level.

Therefore, the full FSXA-API instance can be accessed with the code below, which is utilizing the fact that a working Frontend API service is already configured in the right format when using EcomConfig.

Scope

This code part is meant to be executed on server instances and therefore uses the Frontend API server module.

Dependency

You will need to install the fsxa-api npm package:

npm i fsxa-api

import { FSXARemoteApi } from 'fsxa-api';
import { EcomConfig } from 'fcecom-frontend-api-server';

// Create API for preview state
const previewApi = new FSXARemoteApi(EcomConfig.getFSXAConfig().preview);

// Create API for release state
const releaseApi = new FSXARemoteApi(EcomConfig.getFSXAConfig().release);

// Example: Fetch Project Properties
previewApi.fetchProjectProperties({
  locale: 'en_GB',
})

Last update: February 26, 2024