Users

newrelic_api.users

class newrelic_api.users.Users(api_key=None)

An interface for interacting with the NewRelic user API.

__init__(api_key=None)
Parameters:api_key (str) – The API key. If no key is passed, the environment variable NEW_RELIC_API_KEY is used.
Raises:If the api_key parameter is not present, and no environment variable is present, a newrelic_api.exceptions.ConfigurationException is raised.
list(filter_email=None, filter_ids=None, page=None)

This API endpoint returns a paginated list of the Users associated with your New Relic account. Users can be filtered by their email or by a list of user IDs.

Parameters:
  • filter_email (str) – Filter by user email
  • filter_ids (list of ints) – Filter by user ids
  • page (int) – Pagination index
Return type:

dict

Returns:

The JSON response of the API, with an additional ‘pages’ key if there are paginated results

{
    "users": [
        {
            "id": "integer",
            "first_name": "string",
            "last_name": "string",
            "email": "string",
            "role": "string"
        }
    ],
    "pages": {
        "last": {
            "url": "https://api.newrelic.com/v2/users.json?page=2",
            "rel": "last"
        },
        "next": {
            "url": "https://api.newrelic.com/v2/users.json?page=2",
            "rel": "next"
        }
    }
}
show(id)

This API endpoint returns a single User, identified its ID.

Parameters:id (int) – User ID
Return type:dict
Returns:The JSON response of the API
{
    "user": {
        "id": "integer",
        "first_name": "string",
        "last_name": "string",
        "email": "string",
        "role": "string"
    }
}