Skip to content

Latest commit

 

History

History
682 lines (490 loc) · 22.4 KB

File metadata and controls

682 lines (490 loc) · 22.4 KB

datadog-api-client.v2.UsersApi

All URIs are relative to https://api.datadoghq.com

Method HTTP request Description
createServiceAccount POST /api/v2/service_accounts Create a service account
createUser POST /api/v2/users Create a user
disableUser DELETE /api/v2/users/{user_id} Disable a user
getInvitation GET /api/v2/user_invitations/{user_invitation_uuid} Get a user invitation
getUser GET /api/v2/users/{user_id} Get user details
listUserOrganizations GET /api/v2/users/{user_id}/orgs Get a user organization
listUserPermissions GET /api/v2/users/{user_id}/permissions Get a user permissions
listUsers GET /api/v2/users List all users
sendInvitations POST /api/v2/user_invitations Send invitation emails
updateUser PATCH /api/v2/users/{user_id} Update a user

createServiceAccount

UserResponse createServiceAccount(body)

Create a service account for your organization.

Example

import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v2.createConfiguration();
const apiInstance = new v2.UsersApi(configuration);

let params: v2.UsersApiCreateServiceAccountRequest = {
  // ServiceAccountCreateRequest
  body: {
    data: {
      attributes: {
        email: "jane.doe@example.com",
        name: "name_example",
        serviceAccount: true,
        title: "title_example",
      },
      relationships: {
        roles: {
          data: [
            {
              id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              type: "roles",
            },
          ],
        },
      },
      type: "users",
    },
  },
};

apiInstance
  .createServiceAccount(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Parameters

Name Type Description Notes
body ServiceAccountCreateRequest

Return type

UserResponse

Authorization

apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 OK -
400 Bad Request -
403 Authentication error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createUser

UserResponse createUser(body)

Create a user for your organization.

Example

import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v2.createConfiguration();
const apiInstance = new v2.UsersApi(configuration);

let params: v2.UsersApiCreateUserRequest = {
  // UserCreateRequest
  body: {
    data: {
      attributes: {
        email: "jane.doe@example.com",
        name: "name_example",
        title: "title_example",
      },
      relationships: {
        roles: {
          data: [
            {
              id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              type: "roles",
            },
          ],
        },
      },
      type: "users",
    },
  },
};

apiInstance
  .createUser(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Parameters

Name Type Description Notes
body UserCreateRequest

Return type

UserResponse

Authorization

AuthZ, apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 OK -
400 Bad Request -
403 Authentication error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

disableUser

void disableUser()

Disable a user. Can only be used with an application key belonging to an administrator user.

Example

import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v2.createConfiguration();
const apiInstance = new v2.UsersApi(configuration);

let params: v2.UsersApiDisableUserRequest = {
  // string | The ID of the user.
  userId: "00000000-0000-0000-0000-000000000000",
};

apiInstance
  .disableUser(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Parameters

Name Type Description Notes
userId [string] The ID of the user. defaults to undefined

Return type

void

Authorization

AuthZ, apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

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]

getInvitation

UserInvitationResponse getInvitation()

Returns a single user invitation by its UUID.

Example

import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v2.createConfiguration();
const apiInstance = new v2.UsersApi(configuration);

let params: v2.UsersApiGetInvitationRequest = {
  // string | The UUID of the user invitation.
  userInvitationUuid: "00000000-0000-0000-0000-000000000000",
};

apiInstance
  .getInvitation(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Parameters

Name Type Description Notes
userInvitationUuid [string] The UUID of the user invitation. defaults to undefined

Return type

UserInvitationResponse

Authorization

AuthZ, apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

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]

getUser

UserResponse getUser()

Get a user in the organization specified by the user’s user_id.

Example

import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v2.createConfiguration();
const apiInstance = new v2.UsersApi(configuration);

let params: v2.UsersApiGetUserRequest = {
  // string | The ID of the user.
  userId: "00000000-0000-0000-0000-000000000000",
};

apiInstance
  .getUser(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Parameters

Name Type Description Notes
userId [string] The ID of the user. defaults to undefined

Return type

UserResponse

Authorization

AuthZ, apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK for get user -
403 Authentication error -
404 Not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listUserOrganizations

UserResponse listUserOrganizations()

Get a user organization. Returns the user information and all organizations joined by this user.

Example

import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v2.createConfiguration();
const apiInstance = new v2.UsersApi(configuration);

let params: v2.UsersApiListUserOrganizationsRequest = {
  // string | The ID of the user.
  userId: "00000000-0000-0000-0000-000000000000",
};

apiInstance
  .listUserOrganizations(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Parameters

Name Type Description Notes
userId [string] The ID of the user. defaults to undefined

Return type

UserResponse

Authorization

AuthZ, apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

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]

listUserPermissions

PermissionsResponse listUserPermissions()

Get a user permission set. Returns a list of the user’s permissions granted by the associated user's roles.

Example

import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v2.createConfiguration();
const apiInstance = new v2.UsersApi(configuration);

let params: v2.UsersApiListUserPermissionsRequest = {
  // string | The ID of the user.
  userId: "00000000-0000-0000-0000-000000000000",
};

apiInstance
  .listUserPermissions(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Parameters

Name Type Description Notes
userId [string] The ID of the user. defaults to undefined

Return type

PermissionsResponse

Authorization

AuthZ, apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

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]

listUsers

UsersResponse listUsers()

Get the list of all users in the organization. This list includes all users even if they are deactivated or unverified.

Example

import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v2.createConfiguration();
const apiInstance = new v2.UsersApi(configuration);

let params: v2.UsersApiListUsersRequest = {
  // 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`, `modified_at`, `user_count`. (optional)
  sort: "name",
  // QuerySortOrder | Direction of sort. Options: `asc`, `desc`. (optional)
  sortDir: "desc",
  // string | Filter all users by the given string. Defaults to no filtering. (optional)
  filter: "filter_example",
  // string | Filter on status attribute. Comma separated list, with possible values `Active`, `Pending`, and `Disabled`. Defaults to no filtering. (optional)
  filterStatus: "Active",
};

apiInstance
  .listUsers(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Parameters

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 [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`, `modified_at`, `user_count`. (optional) defaults to 'name'
sortDir QuerySortOrder Direction of sort. Options: `asc`, `desc`. (optional) defaults to undefined
filter [string] Filter all users by the given string. Defaults to no filtering. (optional) defaults to undefined
filterStatus [string] Filter on status attribute. Comma separated list, with possible values `Active`, `Pending`, and `Disabled`. Defaults to no filtering. (optional) defaults to undefined

Return type

UsersResponse

Authorization

AuthZ, apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

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]

sendInvitations

UserInvitationsResponse sendInvitations(body)

Sends emails to one or more users inviting them to join the organization.

Example

import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v2.createConfiguration();
const apiInstance = new v2.UsersApi(configuration);

let params: v2.UsersApiSendInvitationsRequest = {
  // UserInvitationsRequest
  body: {
    data: [],
  },
};

apiInstance
  .sendInvitations(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Parameters

Name Type Description Notes
body UserInvitationsRequest

Return type

UserInvitationsResponse

Authorization

AuthZ, apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 OK -
400 Bad Request -
403 Authentication error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateUser

UserResponse updateUser(body)

Edit a user. Can only be used with an application key belonging to an administrator user.

Example

import { v2 } from "@datadog/datadog-api-client";
import * as fs from "fs";

const configuration = v2.createConfiguration();
const apiInstance = new v2.UsersApi(configuration);

let params: v2.UsersApiUpdateUserRequest = {
  // string | The ID of the user.
  userId: "00000000-0000-0000-0000-000000000000",
  // UserUpdateRequest
  body: {
    data: {
      attributes: {
        disabled: true,
        email: "email_example",
        name: "name_example",
      },
      id: "00000000-0000-0000-0000-000000000000",
      type: "users",
    },
  },
};

apiInstance
  .updateUser(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Parameters

Name Type Description Notes
body UserUpdateRequest
userId [string] The ID of the user. defaults to undefined

Return type

UserResponse

Authorization

AuthZ, apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

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]