Skip to navigation

Create model objects

This guide shows how to create new objects in your landscape model. Useful for automatically filling out your model from another source.

Prerequisites

export ICEPANEL_API_KEY='your-api-key'
export ICEPANEL_ORGANIZATION_ID='your-organization-id'

Steps

1

Get your landscape

Get all landscapes in your organization and select a landscape ID:

GET
/v1/organizations/:organizationId/landscapes
import { IcePanelClient } from "@icepanel/sdk";
async function main() {
const client = new IcePanelClient({
apiKey: "YOUR_API_KEY_HERE",
});
await client.organizations.landscapes.list({
organizationId: "organizationId",
});
}
main();

Note the id of the landscape:

export ICEPANEL_LANDSCAPE_ID='your-landscape-id'
2

Find the root object

Call a GET request with query parameter ?filter[type]=root to find the root model object. Your landscape may have multiple root model objects if you use domains.

GET
/v1/landscapes/:landscapeId/versions/:versionId/model/objects
import { IcePanelClient } from "@icepanel/sdk";
async function main() {
const client = new IcePanelClient({
apiKey: "YOUR_API_KEY_HERE",
});
await client.model.objects.list({
landscapeId: "landscapeId",
versionId: "versionId",
});
}
main();

Note the id from the response. This is the parentId for any top-level objects you create.

3

Create an object

Create a new model object as a child of the root:

POST
/v1/landscapes/:landscapeId/versions/:versionId/model/objects
import { IcePanelClient } from "@icepanel/sdk";
async function main() {
const client = new IcePanelClient({
apiKey: "YOUR_API_KEY_HERE",
});
await client.model.objects.create({
landscapeId: "landscapeId",
versionId: "versionId",
body: {
name: "string",
parentId: "string",
type: "actor",
},
});
}
main();

Below is a list of different objects you can create.

Object types

TypeDescription
rootA root object of a landscape.
systemA top-level system or bounded context
appAn application or service within a system
componentA component within an app
storeA data store (database, queue, cache)
actorAn external user, team, or system
groupA logical grouping within a diagram