Chilkat Online Tools

Mono / Postman API / Fetch All User Resource

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Chilkat.Http http = new Chilkat.Http();
bool success;

http.SetRequestHeader("Authorization","{{apiKey}}");
http.SetRequestHeader("X-API-Key","{{postman_api_key}}");

Chilkat.StringBuilder sbResponseBody = new Chilkat.StringBuilder();
success = http.QuickGetSb("https://api.getpostman.com/scim/v2/Users",sbResponseBody);
if (success == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Debug.WriteLine("Response status code = " + Convert.ToString(http.LastStatus));
Debug.WriteLine(sbResponseBody.GetAsString());

Curl Command

curl -X GET
	-H "X-API-Key: {{postman_api_key}}"
	-H "Authorization: {{apiKey}}"
https://api.getpostman.com/scim/v2/Users

Postman Collection Item JSON

{
  "name": "Fetch All User Resource",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "{{apiKey}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://api.getpostman.com/scim/v2/Users",
      "protocol": "https",
      "host": [
        "api",
        "getpostman",
        "com"
      ],
      "path": [
        "scim",
        "v2",
        "Users"
      ],
      "query": [
        {
          "key": "startIndex",
          "value": "1",
          "disabled": true
        },
        {
          "key": "count",
          "value": "100",
          "disabled": true
        },
        {
          "key": "filter",
          "value": "userName eq 'test%40domain.com'",
          "disabled": true
        }
      ]
    },
    "description": "Fetches information on all Postman team members. You can fetch information for a particular user with filters.\n\nNote: By default, this endpoint will return a list of hundred users. To overwrite the default setting, update the 'startIndex=1&count=100' value in the request."
  },
  "response": [
    {
      "name": "200",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apikey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users?startIndex=1&count=100",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users"
          ],
          "query": [
            {
              "key": "startIndex",
              "value": "1"
            },
            {
              "key": "count",
              "value": "100"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\"urn:ietf:params:scim:api:messages:2.0:ListResponse\"],\n    \"totalResults\": 1000,\n    \"startIndex\": 1,\n    \"itemsPerPage\": 2,\n    \"Resources\": [{\n        \"schemas\": [\n            \"urn:ietf:params:scim:schemas:core:2.0:User\"\n        ],\n        \"id\": \"405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99\",\n        \"userName\": \"{{userEmail}}\",\n        \"name\": {\n            \"givenName\": \"Test\",\n            \"familyName\": \"User\"\n        },\n        \"externalId\": \"23123123\",\n        \"active\": true,\n        \"meta\": {\n            \"resourceType\": \"User\",\n            \"created\": \"2021-02-22T04:24:13.000Z\",\n            \"lastModified\": \"2021-02-22T04:24:13.000Z\"\n        }\n    },\n    {\n        \"schemas\": [\n            \"urn:ietf:params:scim:schemas:core:2.0:User\"\n        ],\n        \"id\": \"123775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99\",\n        \"userName\": \"test.user12@okta.local\",\n        \"name\": {\n            \"givenName\": \"Test\",\n            \"familyName\": \"User\"\n        },\n        \"externalId\": \"233133423\",\n        \"active\": true,\n        \"meta\": {\n            \"resourceType\": \"User\",\n            \"created\": \"2021-02-22T04:24:13.000Z\",\n            \"lastModified\": \"2021-02-22T04:24:13.000Z\"\n        }\n    }]\n}"
    },
    {
      "name": "200 - Using filter",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apikey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users?startIndex=1&count=2&filter=userName eq \"test%40domain.com\"",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users"
          ],
          "query": [
            {
              "key": "startIndex",
              "value": "1"
            },
            {
              "key": "count",
              "value": "2"
            },
            {
              "key": "filter",
              "value": "userName eq \"test%40domain.com\"",
              "description": "Enter URL encoded email"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\"urn:ietf:params:scim:api:messages:2.0:ListResponse\"],\n    \"totalResults\": 1000,\n    \"startIndex\": 1,\n    \"itemsPerPage\": 1,\n    \"Resources\": [{\n        \"schemas\": [\n            \"urn:ietf:params:scim:schemas:core:2.0:User\"\n        ],\n        \"id\": \"405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99\",\n        \"userName\": \"{{userEmail}}\",\n        \"name\": {\n            \"givenName\": \"Test\",\n            \"familyName\": \"User\"\n        },\n        \"externalId\": \"23123123\",\n        \"active\": true,\n        \"meta\": {\n            \"resourceType\": \"User\",\n            \"created\": \"2021-02-22T04:24:13.000Z\",\n            \"lastModified\": \"2021-02-22T04:24:13.000Z\"\n        }\n    }]\n}"
    },
    {
      "name": "200 No results",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apikey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users?startIndex=1&count=100",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users"
          ],
          "query": [
            {
              "key": "startIndex",
              "value": "1"
            },
            {
              "key": "count",
              "value": "100"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\"urn:ietf:params:scim:api:messages:2.0:ListResponse\"],\n    \"totalResults\": 0,\n    \"startIndex\": 1,\n    \"itemsPerPage\": 0,\n    \"Resources\": []\n}"
    },
    {
      "name": "400 - Invalid team",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apikey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users?startIndex=1&count=100",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users"
          ],
          "query": [
            {
              "key": "startIndex",
              "value": "1"
            },
            {
              "key": "count",
              "value": "100"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\n        \"urn:ietf:params:scim:api:messages:2.0:Error\"\n    ],\n    \"detail\": \"This Postman team doesn’t exist anymore.\",\n    \"status\": \"400\"\n}"
    },
    {
      "name": "400 - Using incorrect/unsupported filter",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apikey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users?startIndex=1&count=2&filter=username ne \"test%40domain.com\"",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users"
          ],
          "query": [
            {
              "key": "startIndex",
              "value": "1"
            },
            {
              "key": "count",
              "value": "2"
            },
            {
              "key": "filter",
              "value": "username ne \"test%40domain.com\"",
              "description": "Enter URL encoded email"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\n        \"urn:ietf:params:scim:api:messages:2.0:Error\"\n    ],\n    \"detail\": \"You’ve used filter(s) that Postman doesn’t support.\",\n    \"status\": \"400\"\n}"
    },
    {
      "name": "401 - Unauthorized",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "invalidApiKey",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users?startIndex=1&count=100",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users"
          ],
          "query": [
            {
              "key": "startIndex",
              "value": "1"
            },
            {
              "key": "count",
              "value": "100"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\n        \"urn:ietf:params:scim:api:messages:2.0:Error\"\n    ],\n    \"detail\": \"Unable to access the team. Check if you have entered a valid API key.\",\n    \"status\": \"401\"\n}"
    },
    {
      "name": "403 - Admin team mismatch",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apikey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users?startIndex=1&count=100",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users"
          ],
          "query": [
            {
              "key": "startIndex",
              "value": "1"
            },
            {
              "key": "count",
              "value": "100"
            }
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\n        \"urn:ietf:params:scim:api:messages:2.0:Error\"\n    ],\n    \"detail\": \"TYour API key was generated by a Team Admin who is no longer on your team. Use an API key generated by a Team Admin.\",\n    \"status\": \"403\"\n}"
    },
    {
      "name": "429 - Rate limit exceeded",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apiKey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users"
          ],
          "query": [
            {
              "key": "startIndex",
              "value": "1",
              "disabled": true
            },
            {
              "key": "count",
              "value": "10",
              "disabled": true
            }
          ]
        }
      },
      "code": 429,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\n        \"urn:ietf:params:scim:api:messages:2.0:Error\"\n    ],\n    \"detail\": \"That’s 300 attempts in less than a minute. Wait for a minute and then try again.\",\n    \"status\": 429\n}"
    },
    {
      "name": "500 - Something went wrong",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apiKey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users?startIndex=1&count=100",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users"
          ],
          "query": [
            {
              "key": "startIndex",
              "value": "1"
            },
            {
              "key": "count",
              "value": "100"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\n        \"urn:ietf:params:scim:api:messages:2.0:Error\"\n    ],\n    \"detail\": \"Couldn’t fetch members of the team.\",\n    \"status\": \"500\"\n}"
    }
  ]
}