Chilkat Online Tools

delphiDll / Postman API / Fetch User Resource

Back to Collection Items

var
http: HCkHttp;
success: Boolean;
sbResponseBody: HCkStringBuilder;

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

http := CkHttp_Create();

CkHttp_SetRequestHeader(http,'Authorization','{{apiKey}}');

sbResponseBody := CkStringBuilder_Create();
success := CkHttp_QuickGetSb(http,'https://api.getpostman.com/scim/v2/Users/{{id}}',sbResponseBody);
if (success = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

Memo1.Lines.Add('Response status code = ' + IntToStr(CkHttp_getLastStatus(http)));
Memo1.Lines.Add(CkStringBuilder__getAsString(sbResponseBody));

CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);

Curl Command

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

Postman Collection Item JSON

{
  "name": "Fetch User Resource",
  "request": {
    "auth": {
      "type": "noauth"
    },
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "{{apiKey}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://api.getpostman.com/scim/v2/Users/{{id}}",
      "protocol": "https",
      "host": [
        "api",
        "getpostman",
        "com"
      ],
      "path": [
        "scim",
        "v2",
        "Users",
        "{{id}}"
      ]
    },
    "description": "Fetches an individual Postman team member's information."
  },
  "response": [
    {
      "name": "200",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apikey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users/405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users",
            "405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99"
          ]
        }
      },
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\n        \"urn:ietf:params:scim:schemas:core:2.0:User\"\n    ],\n    \"id\": \"405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99\",\n    \"userName\": \"test.user@okta.local\",\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}"
    },
    {
      "name": "400 - Invalid team",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apiKey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users/405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users",
            "405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99"
          ]
        }
      },
      "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": "401 - Unauthorized",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "invalidApiKey",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users/405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users",
            "405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99"
          ]
        }
      },
      "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/405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users",
            "405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99"
          ]
        }
      },
      "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\": \"Your 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": "404 - User Not Found",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apiKey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users/405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users",
            "405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99"
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"schemas\": [\n        \"urn:ietf:params:scim:api:messages:2.0:Error\"\n    ],\n    \"detail\": \"This person isn’t a member of the team.\",\n    \"status\": \"404\"\n}"
    },
    {
      "name": "429 - Rate limit exceeded",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "{{apiKey}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/Users/405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users",
            "405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99"
          ]
        }
      },
      "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/405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99",
          "host": [
            "{{url}}"
          ],
          "path": [
            "Users",
            "405775fe15ed41872a8eea4c8aa2b38cda9749812cc55c99"
          ]
        }
      },
      "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\": \"Unable to fetch information about this team member.\",\n    \"status\": \"500\"\n}"
    }
  ]
}