Installation

View as Markdown

Installation

The installation class defined the installation related queries for the marketplace.

Example:

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});

client.marketplace('organization_uid').installation();
NameTypeDescription
installationUid String

The UID of installation

fetch

The fetch method retrieves a specific installation of an app.

Example:

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});

client.marketplace('organization_uid').installation('installation_uid').fetch()

.then((installation) => console.log(installation));

update

The update installation call is used to update information of an installation.

NameTypeDescription
configObject

Configuration that needs to be updated

server_configObject

Server configuration that needs to be updated

webhooksArray of Objects with webhook_uid and channels

Webhooks attached to the app that needs to be updated

ui_locationsArray of Object with type and meta keys

The location of the app in the UI flow that is to updated

Example:

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});


const updateInstallation = {

 name: 'APP_NAME',

 description: 'APP_DESCRIPTION',

 target_type: 'stack'/'organization',

};


const installation = client.marketplace('organization_uid').installation('installation_uid');

installation = Object.assign(installation, updateInstallation);

installation.update()

.then((installation) => console.log(installation));

uninstall

The uninstall method uninstalls the installation.

Example:

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});

client.marketplace('organization_uid').installation('installation_uid').uninstall()

.then((response) => console.log(response));

configuration

The configuration method retrieves the organization level app installation configuration.

import * as contentstack from '@contentstack/marketplace-sdk' 

const client = contentstack.client({ authtoken: 'TOKEN'}); 

client.marketplace('organization_uid').installation('installation_uid').configuration() 

.then((response) => console.log(response));

getConfigLocation

The getConfigLocation method retrieves the organization level app installation configuration.

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'})


client.marketplace('organization_uid').installation('installation_uid').getConfigLocation()

.then((response) => console.log(response))

setConfiguration

The setConfiguration method updates the organization level app installation configuration.

NameTypeDescription
{ / / config keys } (required)Object

Configuration that needs to be updated

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});


client.marketplace('organization_uid').installation('installation_uid').setConfiguration()

.then((response) => console.log(response));

serverConfig

The serverConfig method retrieves the server side organization level configuration required for the app.

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});

client.marketplace('organization_uid').installation('installation_uid').serverConfig()

.then((response) => console.log(response));

setServerConfig

The setServerConfig method updates the server side organization level configuration required for the app.

NameTypeDescription
{ / / config keys } (required)Object

Configuration that needs to be updated

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});

client.marketplace('organization_uid').installation('installation_uid').setServerConfig({<configuration_details>})

.then((response) => console.log(response));

installationData

The installationData method retrieves the installation data of an app configuration.

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});

client.marketplace('organization_uid').installation('installation_uid').installationData()

.then((response) => console.log(response));

webhooks

The webhooks gives a Webhook instance.

NameTypeDescription
webhook_uid (required)String

The UID of webhook

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});

client.marketplace('organization_uid')..installation('installation_uid').webhooks('webhook_uid');

fetchAll

The fetchAll method retrieves all the installations in your Contentstack organization.

NameTypeDescription
app_uidsString(comma separated)

The App UIDs of which installation need to be listed

installation_uidsString(comma separated)

Installations UID of the app

target_uidsString(comma separated)

Stack API key or organization UID

sortString

Field to sort the results (eg. created_at, updated, at)

orderString

The order in which the response is given

limitNumber

Limit on API response to provide content in the list

skipNumber

Offset for skipping content in response

Example:

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});

client.marketplace('organization_uid').installation().fetchAll({ < optional params object>})

.then((collection) => console.log(collection));

getInstalledApps

The getInstalledApps method retrieves all the installed apps in your Contentstack organization.

NameTypeDescription
include_update_detailsBoolean

To show only apps which have update

target_typeMust use one of ['stack','organization']

Specify whether your app is a stack app or an organization app

target_uidsString(comma separated)

Stack API key or organization UID

sortString

Field to sort the results (eg. created_at, updated, at)

orderString

The order in which the response is given

limitNumber

Limit on API response to provide content in the list

skipNumber

Offset for skipping content in response

Example 1:

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});


client.marketplace('organization_uid').installation().getInstalledApps()

.then((collection) => console.log(collection));

Example 2:

If you have to retrieve the list of apps installed for a specific target UID, use the following code

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});


client.marketplace('organization_uid').installation().getInstalledApps({


	target_uid: 'api_key', 


})


.then((collection) => console.log(collection));

getInstalledUsers

The getInstalledUsers call retrieves the list of users for the organization who installed the apps.

Example:

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});


client.marketplace('organization_uid').installation().getInstalledUsers()

.then((collection) => console.log(collection));

getInstalledStacks

The getInstalledStacks method retrieves the list of all the stacks a user is part of.

Example:

import * as contentstack from '@contentstack/marketplace-sdk'

const client = contentstack.client({ authtoken: 'TOKEN'});


client.marketplace('organization_uid').installation().getInstalledStacks()

.then((collection) => console.log(collection));