This resource represents policies. Use it to get, create, update, and delete policies, to apply them to and remove them from projects, and to inspect the policies and rules that apply to a project.
Returns a paginated summary of all known policies, including their names, descriptions, and which projects each policy is assigned to. Results are paginated using the standard startAt, maxResults, total, isLast and values fields.
manage:jira-configurationConnect apps cannot access this REST resource.
integer
integer
200 response
1
2
3
4
5
6
7
8
9
10
11
12
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import { requestJira } from "@forge/bridge";
const response = await requestJira(`/rest/api/3/policies`, {
headers: {
'Accept': 'application/json'
}
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"isLast": true,
"maxResults": 2154,
"startAt": 2154,
"total": 2154,
"values": [
{
"appliedProjectIds": [
2154
],
"id": "<string>",
"isDefault": true,
"policyDescription": "<string>",
"policyName": "<string>",
"version": 2154
}
]
}Returns the policies applied to a project.
manage:jira-projectConnect apps cannot access this REST resource.
string
Required200 response
array<StatePolicyDocument>
1
2
3
4
5
6
7
8
9
10
11
12
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import { requestJira } from "@forge/bridge";
const response = await requestJira(`/rest/api/3/policies/project/{projectIdOrKey}`, {
headers: {
'Accept': 'application/json'
}
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());1
2
3
4
5
6
7
8
9
10
[
{
"id": "<string>",
"isDefault": true,
"policyDescription": "<string>",
"policyName": "<string>",
"rulesByDomain": {},
"version": 2154
}
]Sets the complete set of policies on a project (full replacement).
A project may have at most one policy assigned. Jira Admin only.
manage:jira-projectConnect apps cannot access this REST resource.
string
Requiredthe request containing the full set of policy IDs to assign
array<string>
200 response
any
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import { requestJira } from "@forge/bridge";
var bodyData = `{
"policyIds": [
"<string>"
]
}`;
const response = await requestJira(`/rest/api/3/policies/project/{projectIdOrKey}/policies`, {
method: 'PUT',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: bodyData
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());Returns the configuration of the queried rule type IDs for a given project. Use this to check whether specific rules are active on a project, and if so, how they are configured. Only rules that are actually active on the project are returned. Rules that are not active are omitted from the response.
manage:jira-projectConnect apps cannot access this REST resource.
string
Requiredarray<string>
200 response
array<StatePolicyRule>
1
2
3
4
5
6
7
8
9
10
11
12
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import { requestJira } from "@forge/bridge";
const response = await requestJira(`/rest/api/3/policies/project/{projectIdOrKey}/rules`, {
headers: {
'Accept': 'application/json'
}
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());1
2
3
4
5
6
7
8
9
[
{
"description": "<string>",
"domain": "<string>",
"properties": {},
"ruleId": "<string>",
"ruleTypeId": "<string>"
}
]Validates whether a set of policies can be applied to a project without actually applying them. Runs the compliance checks for each specified policy against the project's current configuration. This can be called before applying policies to preview potential issues. Jira Admin only.
manage:jira-projectConnect apps cannot access this REST resource.
string
Requiredthe validation request containing policy IDs to check
array<string>
200 response
any
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import { requestJira } from "@forge/bridge";
var bodyData = `{
"policyIds": [
"<string>"
]
}`;
const response = await requestJira(`/rest/api/3/policies/project/{projectIdOrKey}/validate`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: bodyData
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());Adds a policy to a set of projects. Handles partial results: each project is processed independently, and failures on individual projects do not prevent the operation from proceeding on the remaining projects.
Jira Admin only. Returns 200 with the successful and failed project results if at least one project succeeds, or 409 if none do.
manage:jira-configurationConnect apps cannot access this REST resource.
string
Requiredthe request containing the list of project IDs
array<integer>
200 response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import { requestJira } from "@forge/bridge";
var bodyData = `{
"projectIds": [
2154
]
}`;
const response = await requestJira(`/rest/api/3/policies/{policyId}/apply`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: bodyData
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
"failed": [
{
"errors": [
{
"entityId": "<string>",
"entityName": "<string>",
"entityType": "<string>",
"remediationHint": "<string>",
"ruleTypeId": "<string>"
}
],
"message": "<string>",
"projectId": 2154
}
],
"successful": [
{
"errors": [
{
"entityId": "<string>",
"entityName": "<string>",
"entityType": "<string>",
"remediationHint": "<string>",
"ruleTypeId": "<string>"
}
],
"message": "<string>",
"projectId": 2154
}
]
}Removes a policy from a set of projects. Handles partial results: each project is processed independently, and failures on individual projects do not prevent the operation from proceeding on the remaining projects.
Jira Admin only. Returns 200 with the successful and failed project results if at least one project succeeds, or 409 if none do.
manage:jira-configurationConnect apps cannot access this REST resource.
string
Requiredthe request containing the list of project IDs
array<integer>
200 response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import { requestJira } from "@forge/bridge";
var bodyData = `{
"projectIds": [
2154
]
}`;
const response = await requestJira(`/rest/api/3/policies/{policyId}/remove`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: bodyData
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
"failed": [
{
"errors": [
{
"entityId": "<string>",
"entityName": "<string>",
"entityType": "<string>",
"remediationHint": "<string>",
"ruleTypeId": "<string>"
}
],
"message": "<string>",
"projectId": 2154
}
],
"successful": [
{
"errors": [
{
"entityId": "<string>",
"entityName": "<string>",
"entityType": "<string>",
"remediationHint": "<string>",
"ruleTypeId": "<string>"
}
],
"message": "<string>",
"projectId": 2154
}
]
}Rate this page: