Audit
Content
Content - attachments
Content body
Content - children and descendants
Content - macro body
Content comments
Content labels
Content permissions
Content properties
Content restrictions
Content versions
Content watches
Dynamic modules
Experimental
Group
Inline tasks
Label info
Long-running task
Relation
Search
Settings
Space
Space permissions
Space properties
Space settings
Template
Themes
Users

Rate this page:

Experimental

Get Space Labels

Experimental

GET /wiki/rest/api/space/{spaceKey}/label

Returns a list of labels associated with a space. Can provide a prefix as well as other filters to select different types of labels.

Connect app scope requiredREAD

OAuth scopes required
read:confluence-space.summary

Request

Path parameters
spaceKey Required

string

The key of the space to get labels for.

Query parameters
prefix

string

Filters the results to labels with the specified prefix. If this parameter is not specified, then labels with any prefix will be returned.

  • global prefix is used by labels that are on content within the provided space.
  • my prefix can be explicitly added by a user when adding a label via the UI, e.g. 'my:example-label'.
  • team prefix is used for labels applied to the space.

Valid values: global, my, team

start

integer

The starting index of the returned labels.

Default: 0, Minimum: 0, Format: int32
limit

integer

The maximum number of labels to return per page. Note, this may be restricted by fixed system limits.

Default: 200, Minimum: 0, Format: int32

Example

1
2
3
4
5
6
7
8
9
10
11
12
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import api, { route } from "@forge/api";

const response = await api.asApp().requestConfluence(route`/wiki/rest/api/space/{spaceKey}/label`, {
  headers: {
    'Accept': 'application/json'
  }
});

console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());

Responses

Returned if the list of labels is returned.

Content typeValue
application/json

LabelArray

Add labels to a space

Experimental

POST /wiki/rest/api/space/{spaceKey}/label

Adds labels to a piece of content. Does not modify the existing labels.

Notes:

Permissions required: Permission to update the content.

Connect app scope requiredWRITE

OAuth scopes required
write:confluence-space

Request

Path parameters
spaceKey Required

string

The key of the space to add labels to.

Body parameters
Content typeValue
application/json

Array<LabelCreate>

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import api, { route } from "@forge/api";

var bodyData = `[
  {
    "prefix": "<string>",
    "name": "<string>"
  }
]`;

const response = await api.asApp().requestConfluence(route`/wiki/rest/api/space/{spaceKey}/label`, {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: bodyData
});

console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());

Responses

Returned if the labels are added to the content.

Content typeValue
application/json

LabelArray

Remove label from a space

Experimental

DELETE /wiki/rest/api/space/{spaceKey}/label

Connect app scope requiredDELETE

OAuth scopes required
write:confluence-space

Request

Path parameters
spaceKey Required

string

The key of the space to remove a labels from.

Query parameters
name Required

string

The name of the label to remove

prefix

string

The prefix of the label to remove. If not provided defaults to global.

Example

1
2
3
4
5
6
7
8
9
10
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import api, { route } from "@forge/api";

const response = await api.asApp().requestConfluence(route`/wiki/rest/api/space/{spaceKey}/label?name={name}`, {
  method: 'DELETE'
});

console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.text());

Responses

Returned if the label was successfully deleted.

A schema has not been defined for this response code.

Get views

Experimental

GET /wiki/rest/api/analytics/content/{contentId}/views

Get the total number of views a piece of content has.

Connect app scope requiredREAD

OAuth scopes required
read:confluence-content.summary

Request

Path parameters
contentId Required

string

The ID of the content to get the views for.

Query parameters
fromDate

string

The number of views for the content since the date.

Example

1
2
3
4
5
6
7
8
9
10
11
12
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import api, { route } from "@forge/api";

const response = await api.asApp().requestConfluence(route`/wiki/rest/api/analytics/content/{contentId}/views`, {
  headers: {
    'Accept': 'application/json'
  }
});

console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());

Responses

Returns the total number of views for the content.

Content typeValue
application/json

object

Get viewers

Experimental

GET /wiki/rest/api/analytics/content/{contentId}/viewers

Get the total number of distinct viewers a piece of content has.

Connect app scope requiredREAD

OAuth scopes required
read:confluence-content.summary

Request

Path parameters
contentId Required

string

The ID of the content to get the viewers for.

Query parameters
fromDate

string

The number of views for the content since the date.

Example

1
2
3
4
5
6
7
8
9
10
11
12
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import api, { route } from "@forge/api";

const response = await api.asApp().requestConfluence(route`/wiki/rest/api/analytics/content/{contentId}/viewers`, {
  headers: {
    'Accept': 'application/json'
  }
});

console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());

Responses

Returns the total number of distinct viewers for the content.

Content typeValue
application/json

object

Rate this page: