Rate this page:

Properties API

The Properties API provides methods to store key-value pairs on specific product contexts.

Import the Forge API package in your app, as follows:

1
import { properties } from '@forge/api';

The store API has been renamed to the properties API. The existing exported API is still available, however it has been deprecated and will be removed in the future.

onConfluencePage

Sets the value of my-key on the Confluence page with page id 123.

Method signature

1
2
3
properties.onConfluencePage(pageId: string).set(key: string, value: string | number | array | object) => Promise<void>
properties.onConfluencePage(pageId: string).get(key: string) => Promise<string | number | array | object | undefined>
properties.onConfluencePage(pageId: string).delete(key: string) => Promise<void>

Example

Sets the value of my-key on the Confluence page with page id 123.

1
2
3
4
5
6
7
8
9
10
11
// String
properties.onConfluencePage('123').set('my-key', 'hello-world');

// Number
properties.onConfluencePage('123').set('my-key', 123);

// Array
properties.onConfluencePage('123').set('my-key', [ 'hello', 'world' ]);

// Object
properties.onConfluencePage('123').set('my-key', { hello: 'world' });

Gets the value of my-key on the Confluence page with page id 123.

1
properties.onConfluencePage('123').get('my-key');

Deletes the my-key key-value pair on the Confluence page with the page id 123.

1
properties.onConfluencePage('123').delete('my-key');

onConfluenceSpace

Sets the value of my-key on the Confluence space with space key SPACEKEY.

Method signature

1
2
3
properties.onConfluenceSpace(spaceId: string).set(key: string, value: string | number | array | object) => Promise<void>
properties.onConfluenceSpace(spaceId: string).get(key: string) => Promise<string | number | array | object | undefined>
properties.onConfluenceSpace(spaceId: string).delete(key: string) => Promise<void>

Example

Sets the value of my-key on the Confluence space with space key SPACEKEY.

1
2
3
4
5
6
7
8
9
10
11
// String
properties.onConfluenceSpace('SPACEKEY').set('my-key', 'hello-world');

// Number
properties.onConfluenceSpace('SPACEKEY').set('my-key', 123);

// Array
properties.onConfluenceSpace('SPACEKEY').set('my-key', [ 'hello', 'world' ]);

// Object
properties.onConfluenceSpace('SPACEKEY').set('my-key', { hello: 'world' });

Gets the value of my-key on the Confluence space with space key SPACEKEY.

1
properties.onConfluenceSpace('SPACEKEY').get('my-key');

Deletes the my-key key-value pair on the Confluence space with the space key SPACEKEY.

1
properties.onConfluenceSpace('SPACEKEY').delete('my-key');

onJiraIssue

Sets a key-value pair on a specified Jira issue.

Method signature

1
2
3
properties.onJiraIssue(issueKey: string).set(key: string, value: string | number | array | object) => Promise<void>
properties.onJiraIssue(issueKey: string).get(key: string) => Promise<string | number | array | object | undefined>
properties.onJiraIssue(issueKey: string).delete(key: string) => Promise<void>

Example

Sets the value of my-key on the Jira issue with issue key FORGE-123.

1
2
3
4
5
6
7
8
9
10
11
// String
properties.onJiraIssue('FORGE-123').set('my-key', 'hello-world');

// Number
properties.onJiraIssue('FORGE-123').set('my-key', 123);

// Array
properties.onJiraIssue('FORGE-123').set('my-key', [ 'hello', 'world' ]);

// Object
properties.onJiraIssue('FORGE-123').set('my-key', { hello: 'world' });

Gets the value of my-key on the Jira issue with issue key FORGE-123.

1
properties.onJiraIssue('FORGE-123').get('my-key');

Deletes the my-key key-value pair on the Jira issue with the issue key FORGE-123.

1
properties.onJiraIssue('FORGE-123').delete('my-key');

onJiraProject

Sets the value of my-key on the Jira project with project key FORGE.

Method signature

1
2
3
properties.onJiraProject(projectKey: string).set(key: string, value: string | number | array | object) => Promise<void>
properties.onJiraProject(projectKey: string).get(key: string) => Promise<string | number | array | object | undefined>
properties.onJiraProject(projectKey: string).delete(key: string) => Promise<void>

Example

Sets the value of my-key on the Jira project with project key FORGE.

1
2
3
4
5
6
7
8
9
10
11
// String
properties.onJiraProject('FORGE').set('my-key', 'hello-world');

// Number
properties.onJiraProject('FORGE').set('my-key', 123);

// Array
properties.onJiraProject('FORGE').set('my-key', [ 'hello', 'world' ]);

// Object
properties.onJiraProject('FORGE').set('my-key', { hello: 'world' });

Gets the value of my-key on the Jira project with project key FORGE.

1
properties.onJiraProject('FORGE').get('my-key');

Deletes the my-key key-value pair on the Jira project with the project key FORGE.

1
properties.onJiraProject('FORGE').delete('my-key');

Rate this page: