Management SDK - Instance

Instance

Get Locales

//get the locales for a particular instance
var locales = await apiClient.instanceMethods.getLocales(guid)
console.log("Locales for Instance:");
console.log(locales);

Instance User

Get Users, Save User, Delete User

const users = await apiClient.instanceUserMethods.getUsers(guid);
const savedUser = await apiClient.instanceUserMethods.saveUser('user@example.com', [/* InstanceRole[] */], guid, 'First', 'Last');
const deletedUser = await apiClient.instanceUserMethods.deleteUser(1234, guid);

Server User

Get Current User (Me)

//get the current user and all their instance access details
const user = await apiClient.serverUserMethods.me("");

Webhooks

Get Webhook List, Get Webhook, Save Webhook, Delete Webhook

//list the webhooks for the instance
const webhooks = await apiClient.webhookMethods.webhookList(guid)
console.log("Webhooks for Instance:");
console.log(webhooks);

//get a specific webhook
const webhook = await apiClient.webhookMethods.getWebhook(guid, webhooks[0].id);
console.log("Webhook Details:");
console.log(webhook);

//create a new webhook
const newWebhook = await apiClient.webhookMethods.saveWebhook(guid, {
	name: "My New Webhook",
	url: "https://example.com/webhook",
	contentPublishEvents: true,
	contentSaveEvents: true,
	contentWorkflowEvents: true,
	enabled: true,
	instanceGuid: guid,
});

//delete a webhook
await apiClient.webhookMethods.deleteWebhook(guid, newWebhook.id);