Skip to main content

Class: CRestApiClient

frontend.CRestApiClient

CRestApiClient - CromwellCMS REST API Client

Table of contents#

Methods#

Methods#

activatePlugin#

â–¸ activatePlugin(pluginName, options?): Promise<boolean>

Active disabled Plugin

auth admin

Parameters#

NameType
pluginNamestring
options?TRequestOptions

Returns#

Promise<boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:458


activateTheme#

â–¸ activateTheme(themeName, options?): Promise<boolean>

Active disabled Theme

auth admin

Parameters#

NameType
themeNamestring
options?TRequestOptions

Returns#

Promise<boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:449


buildSitemap#

â–¸ buildSitemap(options?): Promise<undefined | TCmsSettings>

Build sitemap at /default_sitemap.xml

auth admin

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<undefined | TCmsSettings>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:591


changeTheme#

â–¸ changeTheme(themeName, options?): Promise<boolean>

Set active Theme

auth admin

Parameters#

NameType
themeNamestring
options?TRequestOptions

Returns#

Promise<boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:467


createPaymentSession#

â–¸ createPaymentSession(input, options?): Promise<undefined | TOrderPaymentSession>

Calculate total price of a cart and creates a payment session via service provider

auth no

Parameters#

NameType
inputTOrderPaymentSession
options?TRequestOptions

Returns#

Promise<undefined | TOrderPaymentSession>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:484


createPublicDir#

â–¸ createPublicDir(dirName, inPath?, options?): Promise<undefined | null | string[]>

Crates a public directory by specified path

auth admin

Parameters#

NameType
dirNamestring
inPath?string
options?TRequestOptions

Returns#

Promise<undefined | null | string[]>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:376


delete#

â–¸ delete<T>(route, input?, options?): Promise<T>

Makes DELETE request to specified route

auth no

Type parameters#

NameType
Tany

Parameters#

NameType
routestring
input?any
options?TRequestOptions

Returns#

Promise<T>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:223


deletePage#

â–¸ deletePage(pageRoute, themeName, options?): Promise<undefined | boolean>

Delete generic page of currently active Theme

auth admin

Parameters#

NameType
pageRoutestring
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:655


deletePlugin#

â–¸ deletePlugin(pluginName, options?): Promise<undefined | boolean>

Delete (uninstall) Plugin

auth admin

Parameters#

NameTypeDescription
pluginNamestringnpm package name of Plugin
options?TRequestOptions-

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:812


deleteTheme#

â–¸ deleteTheme(themeName, options?): Promise<undefined | boolean>

Delete (uninstall) Theme

auth admin

Parameters#

NameTypeDescription
themeNamestringnpm package name of a Theme
options?TRequestOptions-

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:630


downloadPublicFile#

â–¸ downloadPublicFile(fileName, type, inPath?): Promise<void>

Download a public file

auth admin

Parameters#

NameType
fileNamestring
type"file" | "dir"
inPath?string

Returns#

Promise<void>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:384


exportDB#

â–¸ exportDB(tables?, options?): Promise<void>

Export database into Excel (.xlsx) file.

auth admin

Parameters#

NameTypeDescription
tables?("Theme" | "Plugin" | "Post" | "PostComment" | "Tag" | "Product" | "ProductVariant" | "ProductCategory" | "ProductReview" | "Attribute" | "Order" | "User" | "Generic" | "CMS" | "CustomEntity" | "Coupon")[]specify tables to export or export all if not provided
options?TRequestOptions-

Returns#

Promise<void>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:541


fetch#

â–¸ fetch<T>(route, options?): Promise<T>

Make a custom request to a specified route

auth no

Type parameters#

NameType
Tany

Parameters#

NameType
routestring
options?TRequestOptions

Returns#

Promise<T>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:163


forgotPassword#

â–¸ forgotPassword(credentials, options?): Promise<undefined | boolean>

Initiate reset password transaction. Will send a code to user's email

auth no

Parameters#

NameType
credentialsObject
credentials.emailstring
options?TRequestOptions

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:285


get#

â–¸ get<T>(route, options?): Promise<T>

Makes GET request to specified route

auth no

Type parameters#

NameType
Tany

Parameters#

NameType
routestring
options?TRequestOptions

Returns#

Promise<T>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:203


getAdminCmsSettings#

â–¸ getAdminCmsSettings(options?): Promise<TCmsConfig & TCmsPublicSettings & TCmsAdminSettings & TCmsInternalSettings & { robotsContent?: string }>

Get admin CMS settings

auth admin

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<TCmsConfig & TCmsPublicSettings & TCmsAdminSettings & TCmsInternalSettings & { robotsContent?: string }>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:348


getBaseUrl#

â–¸ getBaseUrl(): string

Returns#

string

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:68


getCmsSettings#

â–¸ getCmsSettings(options?): Promise<TCmsSettings>

Get public CMS settings

auth no

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<TCmsSettings>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:340


getCmsStats#

â–¸ getCmsStats(options?): Promise<undefined | TCmsStats>

Get CMS recent statistics, for Admin panel home page

auth admin

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<undefined | TCmsStats>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:508


getCmsStatus#

â–¸ getCmsStatus(options?): Promise<undefined | TCmsStatus>

Get CMS updates info

auth admin

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<undefined | TCmsStatus>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:524


getOrderTotal#

â–¸ getOrderTotal(input, options?): Promise<undefined | TOrder>

Calculate total price of a cart

auth no

Parameters#

NameType
inputTOrderInput
options?TRequestOptions

Returns#

Promise<undefined | TOrder>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:476


getPageConfig#

â–¸ getPageConfig(pageRoute, themeName, options?): Promise<undefined | TPageConfig>

Get page config by page route of currently active Theme

auth no

Parameters#

NameType
pageRoutestring
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | TPageConfig>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:638


getPageConfigs#

â–¸ getPageConfigs(themeName, options?): Promise<undefined | TPageConfig[]>

Get all page config of currently active Theme

auth no

Parameters#

NameType
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | TPageConfig[]>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:699


getPagesInfo#

â–¸ getPagesInfo(themeName, options?): Promise<undefined | TPageInfo[]>

Get all pages info of currently active Theme

auth no

Parameters#

NameType
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | TPageInfo[]>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:691


getPluginAdminBundle#

â–¸ getPluginAdminBundle(pluginName, options?): Promise<undefined | TFrontendBundle>

Get admin panel bundle of Plugin

auth no

Parameters#

NameTypeDescription
pluginNamestringnpm package name of Plugin
options?TRequestOptions-

Returns#

Promise<undefined | TFrontendBundle>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:858


getPluginEntity#

â–¸ getPluginEntity(pluginName, options?): Promise<undefined | TPluginEntity>

Get Plugin's full DB record

auth admin

Parameters#

NameTypeDescription
pluginNamestringnpm package name of Plugin
options?TRequestOptions-

Returns#

Promise<undefined | TPluginEntity>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:840


getPluginFrontendBundle#

â–¸ getPluginFrontendBundle(pluginName, options?): Promise<undefined | TFrontendBundle>

Get frontend bundle of Plugin

auth no

Parameters#

NameTypeDescription
pluginNamestringnpm package name of Plugin
options?TRequestOptions-

Returns#

Promise<undefined | TFrontendBundle>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:849


getPluginList#

â–¸ getPluginList(options?): Promise<undefined | TPackageCromwellConfig[]>

List all installed Plugins

auth admin

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<undefined | TPackageCromwellConfig[]>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:434


getPluginNames#

â–¸ getPluginNames(themeName, options?): Promise<undefined | string[]>

Get all used Plugins in currently active Theme

auth no

Parameters#

NameType
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | string[]>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:683


getPluginSettings#

â–¸ getPluginSettings(pluginName, options?): Promise<any>

Get settings of Plugin

auth no

Parameters#

NameTypeDescription
pluginNamestringnpm package name of Plugin
options?TRequestOptions-

Returns#

Promise<any>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:821


getPluginUpdate#

â–¸ getPluginUpdate(pluginName, options?): Promise<undefined | TCCSVersion>

Get available update info for Plugin

auth admin

Parameters#

NameTypeDescription
pluginNamestringnpm package name of Plugin
options?TRequestOptions-

Returns#

Promise<undefined | TCCSVersion>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:785


getPluginsAtPage#

â–¸ getPluginsAtPage(pageRoute, themeName, options?): Promise<undefined | { pluginInstances?: any ; pluginName: string ; version?: string }[]>

Get all used Plugins at specified page of currently active Theme

auth admin

Parameters#

NameType
pageRoutestring
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | { pluginInstances?: any ; pluginName: string ; version?: string }[]>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:671


getSystemUsage#

â–¸ getSystemUsage(options?): Promise<undefined | TSystemUsage>

Get system specs and usage

auth admin

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<undefined | TSystemUsage>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:516


getThemeConfig#

â–¸ getThemeConfig(themeName, options?): Promise<undefined | TThemeConfig>

Get theme config of currently active Theme

auth no

Parameters#

NameType
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | TThemeConfig>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:715


getThemeInfo#

â–¸ getThemeInfo(themeName, options?): Promise<undefined | TPackageCromwellConfig>

Get theme info of currently active Theme

auth no

Parameters#

NameType
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | TPackageCromwellConfig>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:707


getThemePalette#

â–¸ getThemePalette(themeName, options?): Promise<TPalette>

Update page config by page route of currently active Theme

auth admin

Parameters#

NameType
themeNamestring
options?TRequestOptions

Returns#

Promise<TPalette>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:728


getThemeUpdate#

â–¸ getThemeUpdate(themeName, options?): Promise<undefined | TCCSVersion>

Check if Theme has available update

auth admin

Parameters#

NameType
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | TCCSVersion>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:604


getThemesInfo#

â–¸ getThemesInfo(options?): Promise<undefined | TPackageCromwellConfig[]>

Get info about currently used Theme

auth no

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<undefined | TPackageCromwellConfig[]>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:426


getUserInfo#

â–¸ getUserInfo(options?): Promise<undefined | TUser>

Returns currently logged user profile

auth any

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<undefined | TUser>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:269


importDB#

â–¸ importDB(files, removeSurplus?, options?): Promise<undefined | null | boolean>

Import database from Excel (.xlsx) file/files

auth admin

Parameters#

NameType
filesFile[]
removeSurplus?boolean
options?TRequestOptions

Returns#

Promise<undefined | null | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:567


installPlugin#

â–¸ installPlugin(pluginName, options?): Promise<undefined | boolean>

Install a new Plugin

auth admin

Parameters#

NameTypeDescription
pluginNamestringnpm package name of Plugin
options?TRequestOptions-

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:803


installTheme#

â–¸ installTheme(themeName, options?): Promise<undefined | boolean>

Install a new Theme

auth admin

Parameters#

NameTypeDescription
themeNamestringnpm package name of a Theme
options?TRequestOptions-

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:621


launchCmsUpdate#

â–¸ launchCmsUpdate(options?): Promise<undefined | boolean>

Launch CMS update

auth admin

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:532


logOut#

â–¸ logOut(options?): Promise<any>

Logs user out via cookies

auth any

Parameters#

NameType
options?TRequestOptions

Returns#

Promise<any>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:260


login#

â–¸ login(credentials, options?): Promise<undefined | TUser>

Logs user in via cookies

auth no

Parameters#

NameType
credentialsObject
credentials.emailstring
credentials.passwordstring
options?TRequestOptions

Returns#

Promise<undefined | TUser>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:249


onError#

â–¸ onError(cb, id?): void

Add on error callback. Triggers if any of methods of this client get any type of error

Parameters#

NameType
cb(info: TErrorInfo) => any
id?string

Returns#

void

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:321


onUnauthorized#

â–¸ onUnauthorized(callback, id?): void

Add on unauthorized error callback. Triggers if any of methods of this client get unauthorized error

Parameters#

NameType
callback(route: string) => any
id?string

Returns#

void

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:305


placeOrder#

â–¸ placeOrder(input, options?): Promise<undefined | TOrder>

Place a new order in the store

auth no

Parameters#

NameType
inputTOrderInput
options?TRequestOptions

Returns#

Promise<undefined | TOrder>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:492


placeProductReview#

â–¸ placeProductReview(input, options?): Promise<undefined | TProductReview>

Place a review about some product

auth no

Parameters#

NameType
inputTProductReviewInput
options?TRequestOptions

Returns#

Promise<undefined | TProductReview>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:500


post#

â–¸ post<T>(route, input?, options?): Promise<T>

Makes POST request to specified route

auth no

Type parameters#

NameType
Tany

Parameters#

NameType
routestring
input?any
options?TRequestOptions

Returns#

Promise<T>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:211


put#

â–¸ put<T>(route, input?, options?): Promise<T>

Makes PUT request to specified route

auth no

Type parameters#

NameType
Tany

Parameters#

NameType
routestring
input?any
options?TRequestOptions

Returns#

Promise<T>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:235


readPublicDir#

â–¸ readPublicDir(path?, options?): Promise<undefined | null | string[]>

List files in a public directory by specified path

auth no

Parameters#

NameType
path?string
options?TRequestOptions

Returns#

Promise<undefined | null | string[]>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:368


removeOnError#

â–¸ removeOnError(id): void

Remove on error callback

Parameters#

NameType
idstring

Returns#

void

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:329


removeOnUnauthorized#

â–¸ removeOnUnauthorized(id): void

Remove on unauthorized error callback

Parameters#

NameType
idstring

Returns#

void

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:313


removePublicDir#

â–¸ removePublicDir(dirName, inPath?, options?): Promise<undefined | null | string[]>

Removes a public directory by specified path

auth admin

Parameters#

NameType
dirNamestring
inPath?string
options?TRequestOptions

Returns#

Promise<undefined | null | string[]>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:400


resetPage#

â–¸ resetPage(pageRoute, themeName, options?): Promise<undefined | boolean>

Remove all user's modifications for specified page of currently active Theme

auth admin

Parameters#

NameType
pageRoutestring
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:663


resetPassword#

â–¸ resetPassword(credentials, options?): Promise<undefined | boolean>

Finish reset password transaction. Set a new password

auth no

Parameters#

NameType
credentialsObject
credentials.codestring
credentials.emailstring
credentials.newPasswordstring
options?TRequestOptions

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:293


saveCmsSettings#

â–¸ saveCmsSettings(input, options?): Promise<undefined | TCmsSettings>

Update CMS settings

auth admin

Parameters#

NameType
inputTCmsConfig & TCmsPublicSettings & TCmsAdminSettings & TCmsInternalSettings & { robotsContent?: string }
options?TRequestOptions

Returns#

Promise<undefined | TCmsSettings>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:358


savePageConfig#

â–¸ savePageConfig(config, themeName, options?): Promise<boolean>

Update page config by page route of currently active Theme

auth admin

Parameters#

NameType
configTPageConfig
themeNamestring
options?TRequestOptions

Returns#

Promise<boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:646


savePluginSettings#

â–¸ savePluginSettings(pluginName, settings, options?): Promise<boolean>

Save settings for Plugin

auth admin

Parameters#

NameTypeDescription
pluginNamestringnpm package name of Plugin
settingsany-
options?TRequestOptions-

Returns#

Promise<boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:830


saveThemePalette#

â–¸ saveThemePalette(themeName, palette, options?): Promise<boolean>

Update page config by page route of currently active Theme

auth admin

Parameters#

NameType
themeNamestring
paletteTPalette
options?TRequestOptions

Returns#

Promise<boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:736


signUp#

â–¸ signUp(credentials, options?): Promise<undefined | TUser>

Sign up a new user

auth no

Parameters#

NameType
credentialsTCreateUser
options?TRequestOptions

Returns#

Promise<undefined | TUser>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:277


updatePlugin#

â–¸ updatePlugin(pluginName, options?): Promise<undefined | boolean>

Launch Plugin update

auth admin

Parameters#

NameTypeDescription
pluginNamestringnpm package name of Plugin
options?TRequestOptions-

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:794


updateTheme#

â–¸ updateTheme(themeName, options?): Promise<undefined | boolean>

Launch Theme update

auth admin

Parameters#

NameType
themeNamestring
options?TRequestOptions

Returns#

Promise<undefined | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:612


uploadPublicFiles#

â–¸ uploadPublicFiles(inPath, files, options?): Promise<undefined | null | boolean>

Upload files in specified public directory

auth admin

Parameters#

NameType
inPathstring
filesFile[]
options?TRequestOptions

Returns#

Promise<undefined | null | boolean>

Defined in#

system/core/frontend/src/api/CRestApiClient.ts:408