PingOne Platform APIs

Read Audit Activities

   

GET {{apiPath}}/environments/{{envID}}/activities

You can get all audit activity events for a selected environment. The GET {{apiPath}}/environments/{{envID}}/activities request accepts SCIM filtering expressions to fine-tune the response.

The following sample shows the GET {{apiPath}}/environments/{{envID}}/activities?filter=recordedAt gt "2018-08-20T00:00:00Z" AND recordedAt lt "2018-08-22T23:59:00Z" operation to return all audit activity events for the specified environment. The filtering expression designates a time period between "2018-08-20" and "2018-08-22".

If the activity event is initiated by an administrator on other administrators, this will be indicated in the response by a tags.adminIdentityEvent attribute.

Filtering data

The GET {{apiPath}}/environments/{{envID}}/activities and POST {{apiPath}}/environments/{{envID}}/activities requests accept SCIM filtering expressions to fine-tune the response data. For large collections, additional filtering expressions can be added to the request URL to focus on particular event types.

The minimum filter must include a date range for either the recorded event time or the created event time.

Filter Description

recordedAt lt "yyyy-MM-dd’T’HH:mm:ss.SSSZ"

Audit events recorded before the specified time.

recordedAt gt "yyyy-MM-dd’T’HH:mm:ss.SSSZ"

Audit events recorded after the specified time.

createdAt lt "yyyy-MM-dd’T’HH:mm:ss.SSSZ"

Audit events created before the specified time.

createdAt gt "yyyy-MM-dd’T’HH:mm:ss.SSSZ"

Audit events created after the specified time.

For example, this SCIM filter returns audit events from the start date of "2018-01-01" and an end date of "2018-03-31":

https://api.pingone.com/v1/environments/{{envID}}/activities?filter=recordedAt gt "2018-01-01T00:00:00Z" AND recordedAt lt "2018-03-31T23:59:00Z"

The filter can also include any one of the following:

  • Population ID

  • Actor ID and optional population ID.

  • Action Type and optional population ID

  • Resource ID

  • Resource Type and optional population ID

Filter Description

resources.population.id eq ":id"

Audit events associated with the specified population.

actors.user.id eq ":id"

Audit events performed by the specified user ID or client ID. Optionally, you can include the associated population.

action.type

Audit events recorded for the specified type of action (such as, authentication, password reset). Optionally, you can include the associated population.

resources.id eq ":id"

Audit events recorded for the specified resource.

resources.type

Audit events recorded for the specified type of resource. This can be any one of the following: ALL, USER, ENVIRONMENT, ORGANIZATION. Optionally, you can include the associated population.

tags

Audit events for the adminIdentityEvent tag. Currently, the adminIdentityEvent tag is the only one supported.

These SCIM operators can be applied to the following attributes:

  • eq (equals)

    Supported attributes: correlationid, actors.user.id, actors.user.name, actors.client.id, action.type, resources.id, resources.type, resources.population.id, org.id, environment.id

  • gt (greater than)

    Supported attributes: recordedAt, createdAt

  • lt (less than)

    Supported attributes: recordedAt, createdAt

  • ge (greater than or equal to)

    Supported attributes: recordedAt, createdAt

  • le (less than or equal to)

    Supported attributes: recordedAt, createdAt

  • and (logical AND)

    Logical AND for building compound expressions in which both expressions are true.

  • or (logical OR)

    Logical OR for building compound expressions if either expression is true.

These SCIM operators are not supported: ne (not equal), co (contains), ew (ends with), in (includes), pr (present, is a non-empty or non-null value), sw (starts with), not (logical NOT).

For more information about SCIM syntax and operators, refer to Conventions.

Headers

Authorization      Bearer {{accessToken}}

Example Request

  • cURL

  • C#

  • Go

  • HTTP

  • Java

  • jQuery

  • NodeJS

  • Python

  • PHP

  • Ruby

  • Swift

curl --location --globoff '{{apiPath}}/environments/{{envID}}/activities' \
--header 'Authorization: Bearer {{accessToken}}'
var options = new RestClientOptions("{{apiPath}}/environments/{{envID}}/activities")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Get);
request.AddHeader("Authorization", "Bearer {{accessToken}}");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {

  url := "{{apiPath}}/environments/{{envID}}/activities"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Bearer {{accessToken}}")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
GET /environments/{{envID}}/activities HTTP/1.1
Host: {{apiPath}}
Authorization: Bearer {{accessToken}}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("{{apiPath}}/environments/{{envID}}/activities")
  .method("GET", body)
  .addHeader("Authorization", "Bearer {{accessToken}}")
  .build();
Response response = client.newCall(request).execute();
var settings = {
  "url": "{{apiPath}}/environments/{{envID}}/activities",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer {{accessToken}}"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
var request = require('request');
var options = {
  'method': 'GET',
  'url': '{{apiPath}}/environments/{{envID}}/activities',
  'headers': {
    'Authorization': 'Bearer {{accessToken}}'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "{{apiPath}}/environments/{{envID}}/activities"

payload = {}
headers = {
  'Authorization': 'Bearer {{accessToken}}'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{apiPath}}/environments/{{envID}}/activities');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'Bearer {{accessToken}}'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
require "uri"
require "net/http"

url = URI("{{apiPath}}/environments/{{envID}}/activities")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer {{accessToken}}"

response = http.request(request)
puts response.read_body
var request = URLRequest(url: URL(string: "{{apiPath}}/environments/{{envID}}/activities")!,timeoutInterval: Double.infinity)
request.addValue("Bearer {{accessToken}}", forHTTPHeaderField: "Authorization")

request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()

Example Response

200 OK

{
    "_links": {
        "self": {
            "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/activities"
        }
    },
    "_embedded": {
        "activities": [
            {
                "_links": {
                    "self": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/activities/f931efc3-7696-4f4e-b82e-bf3563e99e8a"
                    }
                },
                "id": "f931efc3-7696-4f4e-b82e-bf3563e99e8a",
                "recordedAt": "2022-06-10T17:09:38.264Z",
                "createdAt": "2022-06-10T17:09:38.281Z",
                "correlationId": "78179748-3103-4f3e-adbc-5bbcd0d02319",
                "actors": {
                    "client": {
                        "id": "830109c7-f8aa-491e-b2f2-8f7532ae85e9",
                        "name": "RichardPatchetWorker",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/applications/830109c7-f8aa-491e-b2f2-8f7532ae85e9",
                        "type": "CLIENT"
                    }
                },
                "action": {
                    "type": "GROUP.CREATED",
                    "description": "Group Created"
                },
                "resources": [
                    {
                        "type": "GROUP",
                        "id": "e195531b-6bc0-435a-96b3-1a377ed7be69",
                        "name": "Training",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/groups/e195531b-6bc0-435a-96b3-1a377ed7be69"
                    }
                ],
                "result": {
                    "status": "SUCCESS",
                    "description": "Created Group Training"
                }
            },
            {
                "_links": {
                    "self": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/activities/4ca96753-8837-419d-8e06-03fac0ec5ae8"
                    }
                },
                "id": "4ca96753-8837-419d-8e06-03fac0ec5ae8",
                "recordedAt": "2022-06-10T17:09:12.775Z",
                "createdAt": "2022-06-10T17:09:12.791Z",
                "correlationId": "45ab6e93-0252-4e46-a144-bda97337b24b",
                "actors": {
                    "client": {
                        "id": "830109c7-f8aa-491e-b2f2-8f7532ae85e9",
                        "name": "RPWorker",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/applications/830109c7-f8aa-491e-b2f2-8f7532ae85e9",
                        "type": "CLIENT"
                    }
                },
                "action": {
                    "type": "GROUP.CREATED",
                    "description": "Group Created"
                },
                "resources": [
                    {
                        "type": "GROUP",
                        "id": "158fcbd3-4d2b-49ed-8874-3a58da8559b3",
                        "name": "MyGroupName1",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/groups/158fcbd3-4d2b-49ed-8874-3a58da8559b3"
                    }
                ],
                "result": {
                    "status": "SUCCESS",
                    "description": "Created Group MyGroupName1"
                }
            },
            {
                "_links": {
                    "self": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/activities/2076da4e-81ae-4cf4-803a-4ccc16419bc9"
                    }
                },
                "id": "2076da4e-81ae-4cf4-803a-4ccc16419bc9",
                "recordedAt": "2022-06-10T17:04:25.518Z",
                "createdAt": "2022-06-10T17:04:25.534Z",
                "correlationId": "28b1f3ca-2ab6-4cc0-b33f-50153c7c9c14",
                "actors": {
                    "client": {
                        "id": "830109c7-f8aa-491e-b2f2-8f7532ae85e9",
                        "name": "RichardPatchetWorker",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/applications/830109c7-f8aa-491e-b2f2-8f7532ae85e9",
                        "type": "CLIENT"
                    }
                },
                "action": {
                    "type": "GROUP.CREATED",
                    "description": "Group Created"
                },
                "resources": [
                    {
                        "type": "GROUP",
                        "id": "ac05e3ff-60e2-4e03-bbac-f9455e6a6d51",
                        "name": "Managers",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/groups/ac05e3ff-60e2-4e03-bbac-f9455e6a6d51"
                    }
                ],
                "result": {
                    "status": "SUCCESS",
                    "description": "Created Group Managers"
                }
            }
        ]
    }
}

Example Response

200 OK

{
    "_links": {
        "self": {
            "href": "https://api.pingone.com/v1/environments/58f92121-b753-4e7e-8d82-23b5bf80efe5/activities?filter=recordedat%20gt%20%222018-08-20T00:00:00Z%22%20AND%20recordedat%20lt%20%222018-08-22T23:59:00Z"
        }
    },
    "_embedded": {
        "activities": [
            {
                "_links": {
                    "self": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/activities/a4a0a8c0-2d47-4efe-a8a5-463684f79f1c"
                    }
                },
                "id": "a4a0a8c0-2d47-4efe-a8a5-463684f79f1c",
                "recordedAt": "2018-08-22T21:47:12.859Z",
                "correlationId": "B2C30206-9EE5-42DE-8B98-D8D3E4913F80",
                "actors": {
                    "client": {
                        "id": "common-services-test",
                        "name": "common-services-test",
                        "type": "CLIENT"
                    }
                },
                "action": {
                    "type": "APPLICATION.DELETED",
                    "description": "Application Deleted"
                },
                "resources": [
                    {
                        "type": "APPLICATION",
                        "id": "60420de9-9d38-44c5-a2a7-4839ded541f0",
                        "name": "UPDATED_1534974432",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/applications/60420de9-9d38-44c5-a2a7-4839ded541f0"
                    }
                ],
                "result": {
                    "status": "SUCCESS",
                    "description": "Deleted Application UPDATED_1534974432 of type 'SERVICE' with disabled state"
                }
            },
            {
                "_links": {
                    "self": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/activities/deee0af7-655f-48cf-ae2e-7571fdfe5ac6"
                    }
                },
                "id": "deee0af7-655f-48cf-ae2e-7571fdfe5ac6",
                "recordedAt": "2018-08-22T21:47:12.005Z",
                "correlationId": "68E80AD8-C9D4-4DB8-93A9-6FF4C88D1E2B",
                "actors": {
                    "client": {
                        "id": "common-services-test",
                        "name": "common-services-test",
                        "type": "CLIENT"
                    }
                },
                "action": {
                    "type": "APPLICATION.UPDATED",
                    "description": "Application Updated"
                },
                "resources": [
                    {
                        "type": "APPLICATION",
                        "id": "60420de9-9d38-44c5-a2a7-4839ded541f0",
                        "name": "UPDATED_1534974432",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/applications/60420de9-9d38-44c5-a2a7-4839ded541f0"
                    }
                ],
                "result": {
                    "status": "SUCCESS",
                    "description": "Updated Application UPDATED_1534974432 of type 'SERVICE' with disabled state"
                }
            },
            {
                "_links": {
                    "self": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/activities/ddc7214e-23a1-401d-be06-ea70a3479be8"
                    }
                },
                "id": "ddc7214e-23a1-401d-be06-ea70a3479be8",
                "recordedAt": "2018-08-22T21:47:11.404Z",
                "correlationId": "3678B778-2DE3-4AB4-BA25-38529D3CE1AF",
                "actors": {
                    "client": {
                        "id": "common-services-test",
                        "name": "common-services-test",
                        "type": "CLIENT"
                    }
                },
                "action": {
                    "type": "APPLICATION.CREATED",
                    "description": "Application Created"
                },
                "resources": [
                    {
                        "type": "APPLICATION",
                        "id": "60420de9-9d38-44c5-a2a7-4839ded541f0",
                        "name": "app_1534974431",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/applications/60420de9-9d38-44c5-a2a7-4839ded541f0"
                    }
                ],
                "result": {
                    "status": "SUCCESS",
                    "description": "Created Application app_1534974431 of type 'SERVICE' with enabled state"
                }
            }
        ]
    }
}