PingOne Platform APIs

Read All Direct-mapped Users (search)

   

POST {{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search

The POST {{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search operation returns information about every user in the specified environment that matches the SCIM filter defined in the body, up to the optionally-defined number of users requested in the body. To filter the results when retrieving users, this request is preferred over Read All Direct-mapped Users with query paramters. The response is limited to a maximum of 200 results.

Request Model

Refer to Direct-mapped search data model for full property descriptions.

Property Type Required?

filter

String

Optional

count

Integer

Optional

While all body properties are optional, a body is required, even if empty, as in {}.

Headers

Authorization      Bearer {{accessToken}}

Content-Type      application/json

Body

raw ( application/json )

{
    "filter": "username sw \"cicerone\"",
    "count": 100
}

Example Request

  • cURL

  • C#

  • Go

  • HTTP

  • Java

  • jQuery

  • NodeJS

  • Python

  • PHP

  • Ruby

  • Swift

curl --location --globoff '{{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
    "filter": "username sw \"cicerone\"",
    "count": 100
}'
var options = new RestClientOptions("{{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer {{accessToken}}");
var body = @"{" + "\n" +
@"    ""filter"": ""username sw \""cicerone\""""," + "\n" +
@"    ""count"": 100" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main

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

func main() {

  url := "{{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search"
  method := "POST"

  payload := strings.NewReader(`{
    "filter": "username sw \"cicerone\"",
    "count": 100
}`)

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

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  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))
}
POST /environments/{{envID}}/v2/DirectMappedUsers/.search HTTP/1.1
Host: {{scimPath}}
Content-Type: application/json
Authorization: Bearer {{accessToken}}

{
    "filter": "username sw \"cicerone\"",
    "count": 100
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"filter\": \"username sw \\\"cicerone\\\"\",\n    \"count\": 100\n}");
Request request = new Request.Builder()
  .url("{{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {{accessToken}}")
  .build();
Response response = client.newCall(request).execute();
var settings = {
  "url": "{{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer {{accessToken}}"
  },
  "data": JSON.stringify({
    "filter": "username sw \"cicerone\"",
    "count": 100
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
var request = require('request');
var options = {
  'method': 'POST',
  'url': '{{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{accessToken}}'
  },
  body: JSON.stringify({
    "filter": "username sw \"cicerone\"",
    "count": 100
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests
import json

url = "{{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search"

payload = json.dumps({
  "filter": "username sw \"cicerone\"",
  "count": 100
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer {{accessToken}}'
}

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

print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer {{accessToken}}'
));
$request->setBody('{\n    "filter": "username sw \\"cicerone\\"",\n    "count": 100\n}');
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 "json"
require "net/http"

url = URI("{{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer {{accessToken}}"
request.body = JSON.dump({
  "filter": "username sw \"cicerone\"",
  "count": 100
})

response = http.request(request)
puts response.read_body
let parameters = "{\n    \"filter\": \"username sw \\\"cicerone\\\"\",\n    \"count\": 100\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "{{scimPath}}/environments/{{envID}}/v2/DirectMappedUsers/.search")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("Bearer {{accessToken}}", forHTTPHeaderField: "Authorization")

request.httpMethod = "POST"
request.httpBody = postData

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

{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:ListResponse"
    ],
    "totalResults": 1,
    "itemsPerPage": 1,
    "Resources": [
        {
            "schemas": [
                "urn:pingidentity:schemas:2.0:DirectMappedUser"
            ],
            "id": "0c507e67-4533-4870-b59b-6d0591ab87e0",
            "meta": {
                "created": "2021-05-12T18:32:15.591Z",
                "lastModified": "2021-05-12T18:32:15.591Z",
                "resourceType": "User",
                "location": "https://scim-api.pingone.com/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/v2/DirectMappedUsers/0c507e67-4533-4870-b59b-6d0591ab87e0"
            },
            "environment": {
                "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
            },
            "account": {
                "canAuthenticate": true,
                "status": "OK"
            },
            "address": {
                "streetAddress": "50 Springview Lane",
                "locality": "Beaconsfield",
                "countryCode": "CA"
            },
            "email": "cicerone_genevieve@example.com",
            "enabled": true,
            "identityProvider": {
                "type": "PING_ONE"
            },
            "lifecycle": {
                "status": "ACCOUNT_OK"
            },
            "mfaEnabled": false,
            "name": {
                "formatted": "Cicerone Geneviève",
                "given": "Cicerone",
                "family": "Geneviève"
            },
            "population": {
                "id": "0353b962-cf0b-4149-8d1b-084e33814924"
            },
            "username": "cicerone_geneviève",
            "verifyStatus": "NOT_INITIATED"
        }
    ]
}