PingOne Platform APIs

Step 1: Get risk policy set IDs

 

GET {{apiPath}}/environments/{{envID}}/riskPolicySets

You can use the GET /environments/{{envID}}/riskPolicySets operation returns the list of risk policy sets associated with the environment identified by its ID in the request URL.

The response data returns information about every risk policy set associated with the specified environment.

Headers

Authorization      Bearer {{accessToken}}

Example Request

  • cURL

  • C#

  • Go

  • HTTP

  • Java

  • jQuery

  • NodeJS

  • Python

  • PHP

  • Ruby

  • Swift

curl --location --globoff '{{apiPath}}/environments/{{envID}}/riskPolicySets' \
--header 'Authorization: Bearer {{accessToken}}'
var options = new RestClientOptions("{{apiPath}}/environments/{{envID}}/riskPolicySets")
{
  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}}/riskPolicySets"
  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}}/riskPolicySets 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}}/riskPolicySets")
  .method("GET", body)
  .addHeader("Authorization", "Bearer {{accessToken}}")
  .build();
Response response = client.newCall(request).execute();
var settings = {
  "url": "{{apiPath}}/environments/{{envID}}/riskPolicySets",
  "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}}/riskPolicySets',
  '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}}/riskPolicySets"

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}}/riskPolicySets');
$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}}/riskPolicySets")

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}}/riskPolicySets")!,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/riskPolicySets"
        },
        "environment": {
            "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
        }
    },
    "_embedded": {
        "riskPolicySets": [
            {
                "_links": {
                    "self": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/riskPolicySets/9d369d4a-f1d5-0f31-12ac-62d9e01ac852"
                    },
                    "environment": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                    }
                },
                "id": "9d369d4a-f1d5-0f31-12ac-62d9e01ac852",
                "environment": {
                    "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                },
                "name": "Default Risk Policy Set",
                "createdAt": "2020-01-01T00:00:00.000Z",
                "updatedAt": "2020-01-01T00:00:00.000Z",
                "defaultResult": {
                    "level": "LOW",
                    "type": "VALUE"
                },
                "riskPolicies": [
                    {
                        "id": "701340dd-a140-4ee7-bcb3-d21c80a4b0ba",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "9d369d4a-f1d5-0f31-12ac-62d9e01ac852"
                        },
                        "name": "Default High Risk Policy",
                        "priority": 10,
                        "result": {
                            "level": "HIGH",
                            "type": "VALUE"
                        },
                        "createdAt": "2020-10-21T17:48:35.614Z",
                        "updatedAt": "2020-10-21T17:48:35.614Z"
                    },
                    {
                        "id": "37b4a601-bdb4-481a-af68-98e557ab8c2e",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "9d369d4a-f1d5-0f31-12ac-62d9e01ac852"
                        },
                        "name": "Default Medium Risk Policy",
                        "priority": 20,
                        "result": {
                            "level": "MEDIUM",
                            "type": "VALUE"
                        },
                        "createdAt": "2020-10-21T17:48:35.614Z",
                        "updatedAt": "2020-10-21T17:48:35.614Z"
                    }
                ],
                "default": true
            },
            {
                "_links": {
                    "self": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/riskPolicySets/433f1337-3c65-4c98-9479-52949c56e7de"
                    },
                    "environment": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                    }
                },
                "id": "433f1337-3c65-4c98-9479-52949c56e7de",
                "environment": {
                    "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                },
                "name": "JB Risk Policy Set",
                "description": "Custom risk policy set description",
                "createdAt": "2020-10-23T17:24:30.469Z",
                "updatedAt": "2020-10-23T17:24:30.469Z",
                "defaultResult": {
                    "level": "LOW",
                    "type": "VALUE"
                },
                "riskPolicies": [
                    {
                        "id": "63305f3e-58be-407b-a7c3-0b20d037a235",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "433f1337-3c65-4c98-9479-52949c56e7de"
                        },
                        "name": "WHITELIST",
                        "priority": 1,
                        "result": {
                            "level": "LOW",
                            "type": "VALUE"
                        },
                        "condition": {
                            "ipRange": [
                                "1.1.1.1/16",
                                "2.2.2.2/24"
                            ],
                            "contains": "${transaction.ip}"
                        },
                        "createdAt": "2020-10-23T17:24:30.469Z",
                        "updatedAt": "2020-10-23T17:24:30.469Z"
                    },
                    {
                        "id": "b6333438-10ab-4150-be7d-122293af2d0e",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "433f1337-3c65-4c98-9479-52949c56e7de"
                        },
                        "name": "ANONYMOUS_NETWORK_DETECTION",
                        "priority": 2,
                        "result": {
                            "level": "HIGH",
                            "type": "VALUE"
                        },
                        "condition": {
                            "equals": true,
                            "value": "${details.anonymousNetworkDetected}"
                        },
                        "createdAt": "2020-10-23T17:24:30.469Z",
                        "updatedAt": "2020-10-23T17:24:30.469Z"
                    },
                    {
                        "id": "03001b83-593a-4625-b8b0-c977e74a4a0a",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "433f1337-3c65-4c98-9479-52949c56e7de"
                        },
                        "name": "GEOVELOCITY_ANOMALY",
                        "priority": 3,
                        "result": {
                            "level": "HIGH",
                            "type": "VALUE"
                        },
                        "condition": {
                            "equals": true,
                            "value": "${details.impossibleTravel}"
                        },
                        "createdAt": "2020-10-23T17:24:30.469Z",
                        "updatedAt": "2020-10-23T17:24:30.469Z"
                    },
                    {
                        "id": "40103bec-13fc-4f0b-87d7-352e03ce006c",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "433f1337-3c65-4c98-9479-52949c56e7de"
                        },
                        "name": "USER_RISK_BEHAVIOR",
                        "priority": 4,
                        "result": {
                            "level": "LOW",
                            "type": "VALUE"
                        },
                        "condition": {
                            "equals": "Medium",
                            "value": "${details.userRiskBehavior.level}"
                        },
                        "createdAt": "2020-10-23T17:24:30.469Z",
                        "updatedAt": "2020-10-23T17:24:30.469Z"
                    },
                    {
                        "id": "595d71c0-c74f-4bea-981b-4e81bacf93d3",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "433f1337-3c65-4c98-9479-52949c56e7de"
                        },
                        "name": "USER_RISK_BEHAVIOR",
                        "priority": 5,
                        "result": {
                            "level": "LOW",
                            "type": "VALUE"
                        },
                        "condition": {
                            "equals": "Low",
                            "value": "${details.userRiskBehavior.level}"
                        },
                        "createdAt": "2020-10-23T17:24:30.469Z",
                        "updatedAt": "2020-10-23T17:24:30.469Z"
                    },
                    {
                        "id": "e7c36884-4d3a-4d35-9561-a6b6bd948f53",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "433f1337-3c65-4c98-9479-52949c56e7de"
                        },
                        "name": "IP_REPUTATION",
                        "priority": 6,
                        "result": {
                            "level": "LOW",
                            "type": "VALUE"
                        },
                        "condition": {
                            "equals": "LOW",
                            "value": "${details.ipAddressReputation.level}"
                        },
                        "createdAt": "2020-10-23T17:24:30.469Z",
                        "updatedAt": "2020-10-23T17:24:30.469Z"
                    },
                    {
                        "id": "1c16c66f-c85f-4e11-b6c4-2efde166d9fe",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "433f1337-3c65-4c98-9479-52949c56e7de"
                        },
                        "name": "MEDIUM_WEIGHTED_POLICY",
                        "priority": 7,
                        "result": {
                            "level": "MEDIUM",
                            "type": "VALUE"
                        },
                        "condition": {
                            "between": {
                                "minScore": 40,
                                "maxScore": 70
                            },
                            "aggregatedWeights": [
                                {
                                    "value": "${details.aggregatedWeights.anonymousNetwork}",
                                    "weight": 4
                                },
                                {
                                    "value": "${details.aggregatedWeights.geoVelocity}",
                                    "weight": 2
                                },
                                {
                                    "value": "${details.aggregatedWeights.ipRisk}",
                                    "weight": 5
                                },
                                {
                                    "value": "${details.aggregatedWeights.userRiskBehavior}",
                                    "weight": 10
                                }
                            ]
                        },
                        "createdAt": "2020-10-23T17:24:30.469Z",
                        "updatedAt": "2020-10-23T17:24:30.469Z"
                    },
                    {
                        "id": "1f31d808-8d11-459c-8011-3ce5ef339c3b",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "433f1337-3c65-4c98-9479-52949c56e7de"
                        },
                        "name": "HIGH_WEIGHTED_POLICY",
                        "priority": 8,
                        "result": {
                            "level": "HIGH",
                            "type": "VALUE"
                        },
                        "condition": {
                            "between": {
                                "minScore": 70,
                                "maxScore": 100
                            },
                            "aggregatedWeights": [
                                {
                                    "value": "${details.aggregatedWeights.anonymousNetwork}",
                                    "weight": 4
                                },
                                {
                                    "value": "${details.aggregatedWeights.geoVelocity}",
                                    "weight": 2
                                },
                                {
                                    "value": "${details.aggregatedWeights.ipRisk}",
                                    "weight": 5
                                },
                                {
                                    "value": "${details.aggregatedWeights.userRiskBehavior}",
                                    "weight": 10
                                }
                            ]
                        },
                        "createdAt": "2020-10-23T17:24:30.469Z",
                        "updatedAt": "2020-10-23T17:24:30.469Z"
                    }
                ],
                "default": false
            },
            {
                "_links": {
                    "self": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/riskPolicySets/a36109f9-e4d5-4095-b91e-f8cadce3b2d5"
                    },
                    "environment": {
                        "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                    }
                },
                "id": "a36109f9-e4d5-4095-b91e-f8cadce3b2d5",
                "environment": {
                    "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                },
                "name": "Use_Case_Risk_Policy_Set",
                "description": "Custom risk policy set",
                "createdAt": "2021-02-22T19:49:36.214Z",
                "updatedAt": "2021-02-22T19:49:36.214Z",
                "defaultResult": {
                    "level": "LOW",
                    "type": "VALUE"
                },
                "riskPolicies": [
                    {
                        "id": "ee5dbfbd-c2a2-4e99-8217-27750a76729e",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "a36109f9-e4d5-4095-b91e-f8cadce3b2d5"
                        },
                        "name": "WHITELIST",
                        "priority": 1,
                        "result": {
                            "level": "LOW",
                            "type": "VALUE"
                        },
                        "condition": {
                            "ipRange": [
                                "1.1.1.1/16",
                                "2.2.2.2/24"
                            ],
                            "contains": "${transaction.ip}"
                        },
                        "createdAt": "2021-02-22T19:49:36.214Z",
                        "updatedAt": "2021-02-22T19:49:36.214Z"
                    },
                    {
                        "id": "52063c24-3a82-4fca-bd0c-3ffe39319f58",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "a36109f9-e4d5-4095-b91e-f8cadce3b2d5"
                        },
                        "name": "ANONYMOUS_NETWORK_DETECTION",
                        "priority": 2,
                        "result": {
                            "level": "HIGH",
                            "type": "VALUE"
                        },
                        "condition": {
                            "equals": true,
                            "value": "${details.anonymousNetworkDetected}"
                        },
                        "createdAt": "2021-02-22T19:49:36.214Z",
                        "updatedAt": "2021-02-22T19:49:36.214Z"
                    },
                    {
                        "id": "5ab010e3-3027-44ce-abbd-f61c23c5da98",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "a36109f9-e4d5-4095-b91e-f8cadce3b2d5"
                        },
                        "name": "GEOVELOCITY_ANOMALY",
                        "priority": 3,
                        "result": {
                            "level": "HIGH",
                            "type": "VALUE"
                        },
                        "condition": {
                            "equals": true,
                            "value": "${details.impossibleTravel}"
                        },
                        "createdAt": "2021-02-22T19:49:36.214Z",
                        "updatedAt": "2021-02-22T19:49:36.214Z"
                    },
                    {
                        "id": "a9baeeb8-202d-4376-afa2-b90994eb23be",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "a36109f9-e4d5-4095-b91e-f8cadce3b2d5"
                        },
                        "name": "USER_RISK_BEHAVIOR",
                        "priority": 4,
                        "result": {
                            "level": "LOW",
                            "type": "VALUE"
                        },
                        "condition": {
                            "equals": "Medium",
                            "value": "${details.userRiskBehavior.level}"
                        },
                        "createdAt": "2021-02-22T19:49:36.214Z",
                        "updatedAt": "2021-02-22T19:49:36.214Z"
                    },
                    {
                        "id": "0448879e-ad09-4efa-b95c-2a9dc49d1728",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "a36109f9-e4d5-4095-b91e-f8cadce3b2d5"
                        },
                        "name": "IP_REPUTATION",
                        "priority": 5,
                        "result": {
                            "level": "LOW",
                            "type": "VALUE"
                        },
                        "condition": {
                            "equals": "LOW",
                            "value": "${details.ipAddressReputation.level}"
                        },
                        "createdAt": "2021-02-22T19:49:36.214Z",
                        "updatedAt": "2021-02-22T19:49:36.214Z"
                    },
                    {
                        "id": "9cb2e89a-8a98-466f-b79e-342278d48773",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "a36109f9-e4d5-4095-b91e-f8cadce3b2d5"
                        },
                        "name": "MEDIUM_WEIGHTED_POLICY",
                        "priority": 6,
                        "result": {
                            "level": "MEDIUM",
                            "type": "VALUE"
                        },
                        "condition": {
                            "between": {
                                "minScore": 40,
                                "maxScore": 70
                            },
                            "aggregatedWeights": [
                                {
                                    "value": "${details.aggregatedWeights.anonymousNetwork}",
                                    "weight": 4
                                },
                                {
                                    "value": "${details.aggregatedWeights.geoVelocity}",
                                    "weight": 2
                                },
                                {
                                    "value": "${details.aggregatedWeights.ipRisk}",
                                    "weight": 5
                                },
                                {
                                    "value": "${details.aggregatedWeights.userRiskBehavior}",
                                    "weight": 10
                                }
                            ]
                        },
                        "createdAt": "2021-02-22T19:49:36.214Z",
                        "updatedAt": "2021-02-22T19:49:36.214Z"
                    },
                    {
                        "id": "79bc3a64-0ead-42e4-b0fa-15fb8e101276",
                        "environment": {
                            "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
                        },
                        "policySet": {
                            "id": "a36109f9-e4d5-4095-b91e-f8cadce3b2d5"
                        },
                        "name": "HIGH_WEIGHTED_POLICY",
                        "priority": 7,
                        "result": {
                            "level": "HIGH",
                            "type": "VALUE"
                        },
                        "condition": {
                            "between": {
                                "minScore": 70,
                                "maxScore": 100
                            },
                            "aggregatedWeights": [
                                {
                                    "value": "${details.aggregatedWeights.anonymousNetwork}",
                                    "weight": 4
                                },
                                {
                                    "value": "${details.aggregatedWeights.geoVelocity}",
                                    "weight": 2
                                },
                                {
                                    "value": "${details.aggregatedWeights.ipRisk}",
                                    "weight": 5
                                },
                                {
                                    "value": "${details.aggregatedWeights.userRiskBehavior}",
                                    "weight": 10
                                }
                            ]
                        },
                        "createdAt": "2021-02-22T19:49:36.214Z",
                        "updatedAt": "2021-02-22T19:49:36.214Z"
                    }
                ],
                "default": false
            }
        ]
    },
    "count": 3,
    "size": 3
}