Rate this page:

Store API

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

Import the runtime in function modules as follows:

1
import api from '@forge/api';

onJiraIssue

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

Method signature

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

Example

Sets a value with the key my-key on the Jira issue with key FORGE-1.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// String
api.store.onJiraIssue('FORGE-1').set('my-key', 'hello-world');

// Number
api.store.onJiraIssue('FORGE-1').set('my-key', 123);

// Array
api.store.onJiraIssue('FORGE-1').set('my-key', [
  'hello',
  'world'
]);

// Object
api.store.onJiraIssue('FORGE-1').set('my-key', {
  hello: 'world'
});

Gets the value for the key my-key on the Jira issue with key FORGE-1.

1
api.store.onJiraIssue('FORGE-1').get('my-key');

Deletes the key-value pair for the key my-key from the Jira issue with key FORGE-1.

1
api.store.onJiraIssue('FORGE-1').delete('my-key');

onJiraProject

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

Method signature

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

Example

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// String
api.store.onJiraProject('FORGE').set('my-key', 'hello-world');

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

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

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

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

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

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

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

onConfluencePage

Sets a key-value pair on a specified Confluence page.

Method signature

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

Example

Sets a value with the key my-key on the Confluence page with ID 123.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// String
api.store.onConfluencePage('123').set('my-key', 'hello-world');

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

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

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

Gets the value for the key my-key on the Confluence page with ID 123.

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

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

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

onConfluenceSpace

Sets a key-value pair on a specified Confluence space.

Method signature

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

Example

Sets a value with the key my-key on the Confluence space with ID 123.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// String
api.store.onConfluenceSpace('123').set('my-key', 'hello-world');

// Number
api.store.onConfluenceSpace('123').set('my-key', 123);

// Array
api.store.onConfluenceSpace('123').set('my-key', [
  'hello',
  'world'
]);

// Object
api.store.onConfluenceSpace('123').set('my-key', {
  hello: 'world'
});

Gets the value for the key my-key on the Confluence space with ID 123.

1
api.store.onConfluenceSpace('123').get('my-key');

Deletes the key-value pair for the key my-key on the Confluence space with ID 123.

1
api.store.onConfluenceSpace('123').delete('my-key');

Rate this page: