Quickstart

In this example, we’ll walk through IcePanel’s data model by listing landscapes, viewing model objects, and finding their model connections.

Prerequisites

Call the API

1

Set your API key

Go to Profile settings -> API keys -> Create API key and create a new key.

For future sessions, store it in a ~/.zshrc or ~/.bashrc

$export ICEPANEL_API_KEY='your-api-key'

Then run source ~/.zshrc (or ~/.bashrc) to apply immediately.

2

List your organizations

This is the top-level model for access control. Landscapes and users belong to an organization.

1import { IcePanelClient } from "@icepanel/sdk";
2
3async function main() {
4 const client = new IcePanelClient({
5 apiKey: "your-api-key",
6 apiVersion: "v1",
7 });
8 const response = await client.organizations.list({});
9 console.log(response);
10}
11main();

Note the id field. This is your organizationId.

3

List your landscapes

A workspace within an organization (like a repository).

1import { IcePanelClient } from "@icepanel/sdk";
2
3async function main() {
4 const client = new IcePanelClient({
5 apiKey: "your-api-key",
6 apiVersion: "v1",
7 });
8 const response = await client.organizations.landscapes.list({
9 organizationId: "organizationId"
10 });
11 console.log(response);
12}
13main();

Note the id field. This is your landscapeId.

4

List model objects

An object within your landscape. It can be a system, app, component, store, actor, group, or root.

1import { IcePanelClient } from "@icepanel/sdk";
2
3async function main() {
4 const client = new IcePanelClient({
5 apiKey: "your-api-key",
6 apiVersion: "v1",
7 });
8 const response = await client.model.objects.list({
9 landscapeId: "landscapeId",
10 versionId: "latest"
11 });
12 console.log(response);
13}
14main();

Note the id of any object. This is your modelObjectId.

5

List model connections

A defined relationship between two model objects. We’ll list model connections where originId = modelObjectId.

1import { IcePanelClient } from "@icepanel/sdk";
2
3async function main() {
4 const client = new IcePanelClient({
5 apiKey: "your-api-key",
6 apiVersion: "v1",
7 });
8 const response = await client.model.connections.list({
9 landscapeId: "landscapeId",
10 versionId: "latest",
11 filter: { originId: "modelObjectId" }
12 });
13 console.log(response);
14}
15main();

Next steps