Chilkat Online Tools

DataFlex / Postman API / All Monitors

Back to Collection Items

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sId
    String sName
    String sUid
    String sOwner
    Integer i
    Integer iCount_i
    String sTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Send ComSetRequestHeader To hoHttp "X-API-Key" "{{postman_api_key}}"

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://api.getpostman.com/monitors" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "monitors": [
    //     {
    //       "id": "1e6b6c77-2031-42d0-9948-76d7251b2dd1",
    //       "name": "Batman & Sherlock Holmes Monitor",
    //       "uid": "5852-1e6b6c77-2031-42d0-9948-76d7251b2dd1",
    //       "owner": "5852"
    //     },
    //     {
    //       "id": "1e6b6cb7-f13d-4000-acb7-0695757174a8",
    //       "name": "Team Level Monitor",
    //       "uid": "5886-1e6b6cb7-f13d-4000-acb7-0695757174a8",
    //       "owner": "5886"
    //     },
    //     {
    //       "id": "1e6b6cc1-c760-48e0-968f-4bfaeeae9af1",
    //       "name": "Postman Echo Monitor",
    //       "uid": "5852-1e6b6cc1-c760-48e0-968f-4bfaeeae9af1",
    //       "owner": "5852"
    //     }
    //   ]
    // }

    // Sample code for parsing the JSON response...
    // Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "monitors" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "monitors[i].id" To sId
        Get ComStringOf Of hoJResp "monitors[i].name" To sName
        Get ComStringOf Of hoJResp "monitors[i].uid" To sUid
        Get ComStringOf Of hoJResp "monitors[i].owner" To sOwner
        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl -X GET
	-H "X-API-Key: {{postman_api_key}}"
https://api.getpostman.com/monitors

Postman Collection Item JSON

{
  "name": "All Monitors",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "https://api.getpostman.com/monitors",
      "protocol": "https",
      "host": [
        "api",
        "getpostman",
        "com"
      ],
      "path": [
        "monitors"
      ]
    },
    "description": "The `/monitors` endpoint returns a list of all [monitors](https://monitor.getpostman.com/) that are accessible by you.\n\nThe response contains an array of monitors information containing the `name`, `id`, `owner` and `uid` of each monitor.\n\n> Requires <a href=\"#authentication\">API Key</a> as `X-Api-Key` request header or `apikey` URL query parameter."
  },
  "response": [
    {
      "name": "Successful Response",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "https://api.getpostman.com/monitors",
          "protocol": "https",
          "host": [
            "api",
            "getpostman",
            "com"
          ],
          "path": [
            "monitors"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json",
          "name": "Content-Type",
          "description": {
            "content": "",
            "type": "text/plain"
          }
        }
      ],
      "cookie": [
        {
          "expires": "Invalid Date",
          "hostOnly": false,
          "httpOnly": false,
          "domain": "getpostman.com",
          "path": "/",
          "secure": false,
          "session": false,
          "value": "yes",
          "key": "getpostmanlogin"
        },
        {
          "expires": "Invalid Date",
          "hostOnly": false,
          "httpOnly": false,
          "domain": "getpostman.com",
          "path": "/",
          "secure": false,
          "session": false,
          "value": "0e9f9b1f3e7218e7fd625cca14597bc771064a433bdd75b5a40196cef86c3fa29d483358e0b254b0a097ac305b132ec8481e2c5b835663fbed3bbb93b5a747cf8776efe85650e29a8e5f0a63906480e5b9e5a9860bef703234812ce9f65ea6dcbc099ac952d1c36338e2d192a793b82a1d8a2dd6dd031f831c08805a9e7ea1f55d46c54cf6ecaecbac84ddf581c8a267a116c0d6d935f19171bce93c6e040c0bd49fc1325bdb8929914548d7c0cae78796aba4073dc9ab63194a90e430919d8757c7ccb7b4dffc61b9cd4a748edc88d0b4ba727c83ea1af546908ff63a1e2ee9784a7b9af2f61997e0dd34adcb479151d11d0e8d67ba76050d55c7bbb88f2f700e14f848f6b929b441869fba53436eb7983660d0e4af82aa0dc5c47dddf974599280179889c03c3e38212eaa8270c641298f0a49b923ed3d04d61e2c6c25844b67df9e4814d378b440e8124e429dc292a147038a57c03e8b8ece700b376fcf8e002dca35142f97b5f49144e2f7477b99d767dff12bb37dd846419051bdaa4c6d931545a5df09bda8a80a336585e5d6ba44f087607512344f91321a359dc150cb411600fbf0d974f63116046d681d3f82a16e50e3bb69c463430e284f64e007f354a9ed4a2afdb27caad0414d451875ec78ea98924e32d8f881eb2c260b348e00baf782",
          "key": "postman.sid"
        }
      ],
      "body": "{\n  \"monitors\": [\n    {\n      \"id\": \"1e6b6c77-2031-42d0-9948-76d7251b2dd1\",\n      \"name\": \"Batman & Sherlock Holmes Monitor\",\n      \"uid\": \"5852-1e6b6c77-2031-42d0-9948-76d7251b2dd1\",\n      \"owner\": \"5852\"\n    },\n    {\n      \"id\": \"1e6b6cb7-f13d-4000-acb7-0695757174a8\",\n      \"name\": \"Team Level Monitor\",\n      \"uid\": \"5886-1e6b6cb7-f13d-4000-acb7-0695757174a8\",\n      \"owner\": \"5886\"\n    },\n    {\n      \"id\": \"1e6b6cc1-c760-48e0-968f-4bfaeeae9af1\",\n      \"name\": \"Postman Echo Monitor\",\n      \"uid\": \"5852-1e6b6cc1-c760-48e0-968f-4bfaeeae9af1\",\n      \"owner\": \"5852\"\n    }\n  ]\n}"
    }
  ]
}