@timbenniks/contentstack-endpoints
v1.0.5
Published
A utility package to get Contentstack API endpoints based on cloud and region
Downloads
370
Maintainers
Readme
@timbenniks/contentstack-endpoints
A utility package that provides Contentstack API endpoints based on cloud provider and region. This package helps you easily get the correct API endpoints for different Contentstack environments and regions.
Beware: this is open source and maintained by @timbenniks and it's not officially supported contentstack. Support questions go to @timbenniks directly.
Installation
npm install @timbenniks/contentstack-endpoints
Usage
ESM (recommended)
import { getContentstackEndpoints } from "@timbenniks/contentstack-endpoints";
// Get default North America endpoints
const naEndpoints = getContentstackEndpoints();
console.log(naEndpoints.contentDelivery); // https://cdn.contentstack.io
// Get Azure Europe endpoints
const azureEuEndpoints = getContentstackEndpoints(Region.AZURE_EU);
console.log(azureEuEndpoints.contentDelivery); // https://azure-eu-cdn.contentstack.com
CommonJS
const {
getContentstackEndpoints,
} = require("@timbenniks/contentstack-endpoints");
// Get default North America endpoints
const naEndpoints = getContentstackEndpoints();
console.log(naEndpoints.contentDelivery); // https://cdn.contentstack.io
API
getContentstackEndpoints(region?: Region, omitHttps: boolean): ContentstackEndpoints
Returns an object containing all Contentstack API endpoints for the specified cloud and region.
Parameters
region
asRegion.US
,Region.EU
,Region.AZURE_NA
,Region.AZURE_EU
, orRegion.GCP_NA
omitHttps
as boolean
Returns
An object containing the following endpoints:
contentDelivery
: Content Delivery API endpointcontentManagement
: Content Management API endpointimageDelivery
: Image Delivery API endpointassets
: Assets API endpointautomate
: Automate API endpoint (not available for GCP)graphql
: GraphQL API endpointgraphqlPreview
: GraphQL Preview API endpointbrandKit
: Brand Kit API endpointbrandKitGenAI
: Brand Kit GenAI and Knowledge Vault endpointpersonalizeManagement
: Personalize Management API endpointpersonalizeEdge
: Personalize Edge API endpointapplication
: Contentstack web applicationpreview
: REST Preview API endpoint
License
MIT