Skip to content

createClient

The createClient function creates an instance of the Content Island API client.

Example:

import { createClient } from '@content-island/api-client';
const client = createClient({
accessToken: 'YOUR_ACCESS_TOKEN',
// ... additional options
});

Interface

function createClient(options: Options): ApiClient;

Parameters

This function accepts a configuration object with the following properties:

interface Options {
accessToken: string;
domain?: string;
apiVersion?: string;
}
NameDescription
accessTokenYour project’s access token.
You can find this token in the General tab.
domainDomain used for requests. Useful if you’re using Content Island On Premise.
Default: api.contentisland.net
apiVersionVersion of the REST API.
Default: 1.0

Output

The createClient function returns an instance of the Content Island API client. This instance has methods to interact with the API, such as getContentList, getProject, etc.

interface ApiClient {
getProject: () => Promise<Project>;
getContentList: (queryParam?: QueryParams) => Promise<Content[]>;
getContent: (id: string, queryParam?: QueryParams) => Promise<Content>;
}