All URIs are relative to https://api.datadoghq.com
| Method | HTTP request | Description |
|---|---|---|
| addPermissionToRole | POST /api/v2/roles/{role_id}/permissions | Grant permission to a role |
| addUserToRole | POST /api/v2/roles/{role_id}/users | Add a user to a role |
| createRole | POST /api/v2/roles | Create role |
| deleteRole | DELETE /api/v2/roles/{role_id} | Delete role |
| getRole | GET /api/v2/roles/{role_id} | Get a role |
| listPermissions | GET /api/v2/permissions | List permissions |
| listRolePermissions | GET /api/v2/roles/{role_id}/permissions | List permissions for a role |
| listRoleUsers | GET /api/v2/roles/{role_id}/users | Get all users of a role |
| listRoles | GET /api/v2/roles | List roles |
| removePermissionFromRole | DELETE /api/v2/roles/{role_id}/permissions | Revoke permission |
| removeUserFromRole | DELETE /api/v2/roles/{role_id}/users | Remove a user from a role |
| updateRole | PATCH /api/v2/roles/{role_id} | Update a role |
PermissionsResponse addPermissionToRole(body)
Adds a permission to a role.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiAddPermissionToRoleRequest = {
// string | The ID of the role.
roleId: "role_id_example",
// RelationshipToPermission
body: {
data: {
id: "id_example",
type: "permissions",
},
},
};
apiInstance
.addPermissionToRole(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| body | RelationshipToPermission | ||
| roleId | [string] | The ID of the role. | defaults to undefined |
PermissionsResponse
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Authentication error | - |
| 404 | Not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UsersResponse addUserToRole(body)
Adds a user to a role.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiAddUserToRoleRequest = {
// string | The ID of the role.
roleId: "role_id_example",
// RelationshipToUser
body: {
data: {
id: "00000000-0000-0000-0000-000000000000",
type: "users",
},
},
};
apiInstance
.addUserToRole(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| body | RelationshipToUser | ||
| roleId | [string] | The ID of the role. | defaults to undefined |
UsersResponse
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Authentication error | - |
| 404 | Not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RoleCreateResponse createRole(body)
Create a new role for your organization.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiCreateRoleRequest = {
// RoleCreateRequest
body: {
data: {
attributes: {
name: "developers",
},
relationships: {
permissions: {
data: [
{
id: "id_example",
type: "permissions",
},
],
},
users: {
data: [],
},
},
type: "roles",
},
},
};
apiInstance
.createRole(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| body | RoleCreateRequest |
RoleCreateResponse
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Authentication error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
void deleteRole()
Disables a role.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiDeleteRoleRequest = {
// string | The ID of the role.
roleId: "role_id_example",
};
apiInstance
.deleteRole(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| roleId | [string] | The ID of the role. | defaults to undefined |
void
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 204 | OK | - |
| 403 | Authentication error | - |
| 404 | Not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RoleResponse getRole()
Get a role in the organization specified by the role’s role_id.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiGetRoleRequest = {
// string | The ID of the role.
roleId: "role_id_example",
};
apiInstance
.getRole(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| roleId | [string] | The ID of the role. | defaults to undefined |
RoleResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 403 | Authentication error | - |
| 404 | Not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PermissionsResponse listPermissions()
Returns a list of all permissions, including name, description, and ID.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
apiInstance
.listPermissions()
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));This endpoint does not need any parameter.
PermissionsResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Authentication error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PermissionsResponse listRolePermissions()
Returns a list of all permissions for a single role.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiListRolePermissionsRequest = {
// string | The ID of the role.
roleId: "role_id_example",
};
apiInstance
.listRolePermissions(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| roleId | [string] | The ID of the role. | defaults to undefined |
PermissionsResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 403 | Authentication error | - |
| 404 | Not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UsersResponse listRoleUsers()
Gets all users of a role.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiListRoleUsersRequest = {
// string | The ID of the role.
roleId: "role_id_example",
// number | Size for a given page. (optional)
pageSize: 10,
// number | Specific page number to return. (optional)
pageNumber: 0,
// string | User attribute to order results by. Sort order is **ascending** by default. Sort order is **descending** if the field is prefixed by a negative sign, for example `sort=-name`. Options: `name`, `email`, `status`. (optional)
sort: "name",
// string | Filter all users by the given string. Defaults to no filtering. (optional)
filter: "filter_example",
};
apiInstance
.listRoleUsers(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| roleId | [string] | The ID of the role. | defaults to undefined |
| pageSize | [number] | Size for a given page. | (optional) defaults to 10 |
| pageNumber | [number] | Specific page number to return. | (optional) defaults to 0 |
| sort | [string] | User attribute to order results by. Sort order is ascending by default. Sort order is descending if the field is prefixed by a negative sign, for example `sort=-name`. Options: `name`, `email`, `status`. | (optional) defaults to 'name' |
| filter | [string] | Filter all users by the given string. Defaults to no filtering. | (optional) defaults to undefined |
UsersResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 403 | Authentication error | - |
| 404 | Not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RolesResponse listRoles()
Returns all roles, including their names and IDs.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiListRolesRequest = {
// number | Size for a given page. (optional)
pageSize: 10,
// number | Specific page number to return. (optional)
pageNumber: 0,
// RolesSort | Sort roles depending on the given field. Sort order is **ascending** by default. Sort order is **descending** if the field is prefixed by a negative sign, for example: `sort=-name`. (optional)
sort: "name",
// string | Filter all roles by the given string. (optional)
filter: "filter_example",
};
apiInstance
.listRoles(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| pageSize | [number] | Size for a given page. | (optional) defaults to 10 |
| pageNumber | [number] | Specific page number to return. | (optional) defaults to 0 |
| sort | RolesSort | Sort roles depending on the given field. Sort order is ascending by default. Sort order is descending if the field is prefixed by a negative sign, for example: `sort=-name`. | (optional) defaults to undefined |
| filter | [string] | Filter all roles by the given string. | (optional) defaults to undefined |
RolesResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 403 | Authentication error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PermissionsResponse removePermissionFromRole(body)
Removes a permission from a role.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiRemovePermissionFromRoleRequest = {
// string | The ID of the role.
roleId: "role_id_example",
// RelationshipToPermission
body: {
data: {
id: "id_example",
type: "permissions",
},
},
};
apiInstance
.removePermissionFromRole(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| body | RelationshipToPermission | ||
| roleId | [string] | The ID of the role. | defaults to undefined |
PermissionsResponse
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Authentication error | - |
| 404 | Not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UsersResponse removeUserFromRole(body)
Removes a user from a role.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiRemoveUserFromRoleRequest = {
// string | The ID of the role.
roleId: "role_id_example",
// RelationshipToUser
body: {
data: {
id: "00000000-0000-0000-0000-000000000000",
type: "users",
},
},
};
apiInstance
.removeUserFromRole(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| body | RelationshipToUser | ||
| roleId | [string] | The ID of the role. | defaults to undefined |
UsersResponse
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Authentication error | - |
| 404 | Not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RoleUpdateResponse updateRole(body)
Edit a role. Can only be used with application keys belonging to administrators.
import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";
const configuration = v2.createConfiguration();
const apiInstance = new v2.RolesApi(configuration);
let params: v2.RolesApiUpdateRoleRequest = {
// string | The ID of the role.
roleId: "role_id_example",
// RoleUpdateRequest
body: {
data: {
attributes: {
name: "name_example",
},
id: "00000000-0000-0000-0000-000000000000",
type: "roles",
},
},
};
apiInstance
.updateRole(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| body | RoleUpdateRequest | ||
| roleId | [string] | The ID of the role. | defaults to undefined |
RoleUpdateResponse
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Authentication error | - |
| 404 | Not found | - |
| 422 | Unprocessable Entity | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]