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
1import { IcePanelClient } from "@icepanel/sdk";
2
3async function main() {
4 const client = new IcePanelClient({
5 apiKey: "YOUR_API_KEY_HERE",
6 });
7 await client.organizations.landscapes.list("organizationId");
8}
9main();

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
1import { IcePanelClient } from "@icepanel/sdk";
2
3async function main() {
4 const client = new IcePanelClient({
5 apiKey: "YOUR_API_KEY_HERE",
6 });
7 await client.model.objects.list("landscapeId", "versionId", {});
8}
9main();

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
1import { IcePanelClient } from "@icepanel/sdk";
2
3async function main() {
4 const client = new IcePanelClient({
5 apiKey: "YOUR_API_KEY_HERE",
6 });
7 await client.model.objects.create("landscapeId", "versionId", {
8 body: {
9 name: "string",
10 parentId: "string",
11 type: "actor",
12 },
13 });
14}
15main();

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