Installation
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();| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| config | Object | Configuration that needs to be updated |
| server_config | Object | Server configuration that needs to be updated |
| webhooks | Array of Objects with webhook_uid and channels | Webhooks attached to the app that needs to be updated |
| ui_locations | Array 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.
| Name | Type | Description |
|---|---|---|
| { / / 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.
| Name | Type | Description |
|---|---|---|
| { / / 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| app_uids | String(comma separated) | The App UIDs of which installation need to be listed |
| installation_uids | String(comma separated) | Installations UID of the app |
| target_uids | String(comma separated) | Stack API key or organization UID |
| sort | String | Field to sort the results (eg. created_at, updated, at) |
| order | String | The order in which the response is given |
| limit | Number | Limit on API response to provide content in the list |
| skip | Number | 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.
| Name | Type | Description |
|---|---|---|
| include_update_details | Boolean | To show only apps which have update |
| target_type | Must use one of ['stack','organization'] | Specify whether your app is a stack app or an organization app |
| target_uids | String(comma separated) | Stack API key or organization UID |
| sort | String | Field to sort the results (eg. created_at, updated, at) |
| order | String | The order in which the response is given |
| limit | Number | Limit on API response to provide content in the list |
| skip | Number | 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));