Chilkat Online Tools

DataFlex / Monitoring API / Get Alarm History

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vQueryParams
    Handle hoQueryParams
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sSummary
    String sTimestamp
    String sTimestampTriggered
    String sAlarmId
    Boolean iIsEnabled
    Integer i
    Integer iCount_i
    String sTemp1
    Boolean bTemp1

    // 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

    Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
    If (Not(IsComObjectCreated(hoQueryParams))) Begin
        Send CreateComObject of hoQueryParams
    End
    Get ComUpdateString Of hoQueryParams "alarmHistorytype" "STATE_HISTORY" To iSuccess
    Get ComUpdateString Of hoQueryParams "page" "" To iSuccess
    Get ComUpdateInt Of hoQueryParams "limit" 576 To iSuccess
    Get ComUpdateString Of hoQueryParams "timestampGreaterThanOrEqualTo" "2021-12-02T08:38:26.979Z" To iSuccess
    Get ComUpdateString Of hoQueryParams "timestampLessThan" "2021-12-02T08:38:26.979Z" To iSuccess

    Send ComSetRequestHeader To hoHttp "opc-request-id" "pariatur nostrud eiusmod"
    Send ComSetRequestHeader To hoHttp "Authorization" "{{signature}}"
    Send ComSetRequestHeader To hoHttp "Date" "{{date}}"

    Get pvComObject of hoQueryParams to vQueryParams
    Get ComQuickRequestParams Of hoHttp "GET" "https://telemetry.{{region}}.oraclecloud.com/20180401/alarms/:alarmId/history" vQueryParams To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess

    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 ComStatusCode Of hoResp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComHeader Of hoResp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp

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

    // {
    //   "alarmId": "cupidatat",
    //   "entries": [
    //     {
    //       "summary": "irure esse o",
    //       "timestamp": "1989-09-04T12:31:35.740Z",
    //       "timestampTriggered": "2011-07-22T15:36:33.587Z"
    //     },
    //     {
    //       "summary": "occaecat irure Lorem tempor",
    //       "timestamp": "1946-03-18T08:38:09.867Z",
    //       "timestampTriggered": "1971-11-21T14:18:35.074Z"
    //     }
    //   ],
    //   "isEnabled": false
    // }

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

    Get ComStringOf Of hoJResp "alarmId" To sAlarmId
    Get ComBoolOf Of hoJResp "isEnabled" To iIsEnabled
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "entries" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "entries[i].summary" To sSummary
        Get ComStringOf Of hoJResp "entries[i].timestamp" To sTimestamp
        Get ComStringOf Of hoJResp "entries[i].timestampTriggered" To sTimestampTriggered
        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl -G -d "alarmHistorytype=STATE_HISTORY"
	-d "page="
	-d "limit=576"
	-d "timestampGreaterThanOrEqualTo=2021-12-02T08%3A38%3A26.979Z"
	-d "timestampLessThan=2021-12-02T08%3A38%3A26.979Z"
	-H "opc-request-id: pariatur nostrud eiusmod"
	-H "Date: {{date}}"
	-H "Authorization: {{signature}}"
https://telemetry.{{region}}.oraclecloud.com/20180401/alarms/:alarmId/history

Postman Collection Item JSON

{
  "name": "Get Alarm History",
  "request": {
    "method": "GET",
    "header": [
      {
        "description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
        "key": "opc-request-id",
        "value": "pariatur nostrud eiusmod"
      },
      {
        "key": "Date",
        "value": "{{date}}",
        "description": "(Required) Current Date",
        "type": "text"
      },
      {
        "key": "Authorization",
        "value": "{{signature}}",
        "description": "(Required) Signature Authentication on Authorization header",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/alarms/:alarmId/history?alarmHistorytype=STATE_HISTORY&page=&limit=576&timestampGreaterThanOrEqualTo=2021-12-02T08:38:26.979Z&timestampLessThan=2021-12-02T08:38:26.979Z",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "alarms",
        ":alarmId",
        "history"
      ],
      "query": [
        {
          "key": "alarmHistorytype",
          "value": "STATE_HISTORY",
          "description": "The type of history entries to retrieve. State history (STATE_HISTORY) or state transition history (STATE_TRANSITION_HISTORY).\nIf not specified, entries of both types are retrieved.\n\nExample: `STATE_HISTORY`\n"
        },
        {
          "key": "page",
          "value": "",
          "description": "For list pagination. The value of the `opc-next-page` response header from the previous \"List\" call.\nFor important details about how pagination works, see [List Pagination](https://docs.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine).\n"
        },
        {
          "key": "limit",
          "value": "576",
          "description": "For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call.\nFor important details about how pagination works, see [List Pagination](https://docs.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine).\n\nDefault: 1000\n\nExample: 500\n"
        },
        {
          "key": "timestampGreaterThanOrEqualTo",
          "value": "2021-12-02T08:38:26.979Z",
          "description": "A filter to return only alarm history entries with timestamps occurring on or after the specified date and time. Format defined by RFC3339.\n\nExample: `2019-01-01T01:00:00.789Z`\n"
        },
        {
          "key": "timestampLessThan",
          "value": "2021-12-02T08:38:26.979Z",
          "description": "A filter to return only alarm history entries with timestamps occurring before the specified date and time. Format defined by RFC3339.\n\nExample: `2019-01-02T01:00:00.789Z`\n"
        }
      ],
      "variable": [
        {
          "key": "alarmId",
          "value": "mollit in Duis enim",
          "description": "(Required) The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of an alarm.\n"
        }
      ]
    },
    "description": "Get the history of the specified alarm.\nFor important limits information, see [Limits on Monitoring](https://docs.oracle.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#Limits).\n\nThis call is subject to a Monitoring limit that applies to the total number of requests across all alarm operations.\nMonitoring might throttle this call to reject an otherwise valid request when the total rate of alarm operations exceeds 10 requests,\nor transactions, per second (TPS) for a given tenancy.\n"
  },
  "response": [
    {
      "name": "Successfully retrieved alarm history.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
            "key": "opc-request-id",
            "value": "pariatur nostrud eiusmod"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/alarms/:alarmId/history?alarmHistorytype=STATE_HISTORY&page=do ipsum&limit=576&timestampGreaterThanOrEqualTo=1962-12-02T08:38:26.979Z&timestampLessThan=1962-12-02T08:38:26.979Z",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "alarms",
            ":alarmId",
            "history"
          ],
          "query": [
            {
              "key": "alarmHistorytype",
              "value": "STATE_HISTORY"
            },
            {
              "key": "page",
              "value": "do ipsum"
            },
            {
              "key": "limit",
              "value": "576"
            },
            {
              "key": "timestampGreaterThanOrEqualTo",
              "value": "1962-12-02T08:38:26.979Z"
            },
            {
              "key": "timestampLessThan",
              "value": "1962-12-02T08:38:26.979Z"
            }
          ],
          "variable": [
            {
              "key": "alarmId"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-next-page",
          "value": "pariatur nostrud eiusmod",
          "description": "For list pagination. When this header appears in the response, additional pages of results remain.\nFor important details about how pagination works, see [List Pagination](https://docs.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine).\n"
        },
        {
          "key": "opc-request-id",
          "value": "pariatur nostrud eiusmod",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"alarmId\": \"cupidatat\",\n \"entries\": [\n  {\n   \"summary\": \"irure esse o\",\n   \"timestamp\": \"1989-09-04T12:31:35.740Z\",\n   \"timestampTriggered\": \"2011-07-22T15:36:33.587Z\"\n  },\n  {\n   \"summary\": \"occaecat irure Lorem tempor\",\n   \"timestamp\": \"1946-03-18T08:38:09.867Z\",\n   \"timestampTriggered\": \"1971-11-21T14:18:35.074Z\"\n  }\n ],\n \"isEnabled\": false\n}"
    },
    {
      "name": "Bad Request",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
            "key": "opc-request-id",
            "value": "pariatur nostrud eiusmod"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/alarms/:alarmId/history?alarmHistorytype=STATE_HISTORY&page=do ipsum&limit=576&timestampGreaterThanOrEqualTo=1962-12-02T08:38:26.979Z&timestampLessThan=1962-12-02T08:38:26.979Z",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "alarms",
            ":alarmId",
            "history"
          ],
          "query": [
            {
              "key": "alarmHistorytype",
              "value": "STATE_HISTORY"
            },
            {
              "key": "page",
              "value": "do ipsum"
            },
            {
              "key": "limit",
              "value": "576"
            },
            {
              "key": "timestampGreaterThanOrEqualTo",
              "value": "1962-12-02T08:38:26.979Z"
            },
            {
              "key": "timestampLessThan",
              "value": "1962-12-02T08:38:26.979Z"
            }
          ],
          "variable": [
            {
              "key": "alarmId"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "pariatur nostrud eiusmod",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
    },
    {
      "name": "Unauthorized",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
            "key": "opc-request-id",
            "value": "pariatur nostrud eiusmod"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/alarms/:alarmId/history?alarmHistorytype=STATE_HISTORY&page=do ipsum&limit=576&timestampGreaterThanOrEqualTo=1962-12-02T08:38:26.979Z&timestampLessThan=1962-12-02T08:38:26.979Z",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "alarms",
            ":alarmId",
            "history"
          ],
          "query": [
            {
              "key": "alarmHistorytype",
              "value": "STATE_HISTORY"
            },
            {
              "key": "page",
              "value": "do ipsum"
            },
            {
              "key": "limit",
              "value": "576"
            },
            {
              "key": "timestampGreaterThanOrEqualTo",
              "value": "1962-12-02T08:38:26.979Z"
            },
            {
              "key": "timestampLessThan",
              "value": "1962-12-02T08:38:26.979Z"
            }
          ],
          "variable": [
            {
              "key": "alarmId"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "pariatur nostrud eiusmod",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
    },
    {
      "name": "Not Authorized Or Not Found",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
            "key": "opc-request-id",
            "value": "pariatur nostrud eiusmod"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/alarms/:alarmId/history?alarmHistorytype=STATE_HISTORY&page=do ipsum&limit=576&timestampGreaterThanOrEqualTo=1962-12-02T08:38:26.979Z&timestampLessThan=1962-12-02T08:38:26.979Z",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "alarms",
            ":alarmId",
            "history"
          ],
          "query": [
            {
              "key": "alarmHistorytype",
              "value": "STATE_HISTORY"
            },
            {
              "key": "page",
              "value": "do ipsum"
            },
            {
              "key": "limit",
              "value": "576"
            },
            {
              "key": "timestampGreaterThanOrEqualTo",
              "value": "1962-12-02T08:38:26.979Z"
            },
            {
              "key": "timestampLessThan",
              "value": "1962-12-02T08:38:26.979Z"
            }
          ],
          "variable": [
            {
              "key": "alarmId"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "pariatur nostrud eiusmod",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
    },
    {
      "name": "Client is getting throttled, please retry with backoff.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
            "key": "opc-request-id",
            "value": "pariatur nostrud eiusmod"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/alarms/:alarmId/history?alarmHistorytype=STATE_HISTORY&page=do ipsum&limit=576&timestampGreaterThanOrEqualTo=1962-12-02T08:38:26.979Z&timestampLessThan=1962-12-02T08:38:26.979Z",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "alarms",
            ":alarmId",
            "history"
          ],
          "query": [
            {
              "key": "alarmHistorytype",
              "value": "STATE_HISTORY"
            },
            {
              "key": "page",
              "value": "do ipsum"
            },
            {
              "key": "limit",
              "value": "576"
            },
            {
              "key": "timestampGreaterThanOrEqualTo",
              "value": "1962-12-02T08:38:26.979Z"
            },
            {
              "key": "timestampLessThan",
              "value": "1962-12-02T08:38:26.979Z"
            }
          ],
          "variable": [
            {
              "key": "alarmId"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "pariatur nostrud eiusmod",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
    },
    {
      "name": "Internal Server Error",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
            "key": "opc-request-id",
            "value": "pariatur nostrud eiusmod"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/alarms/:alarmId/history?alarmHistorytype=STATE_HISTORY&page=do ipsum&limit=576&timestampGreaterThanOrEqualTo=1962-12-02T08:38:26.979Z&timestampLessThan=1962-12-02T08:38:26.979Z",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "alarms",
            ":alarmId",
            "history"
          ],
          "query": [
            {
              "key": "alarmHistorytype",
              "value": "STATE_HISTORY"
            },
            {
              "key": "page",
              "value": "do ipsum"
            },
            {
              "key": "limit",
              "value": "576"
            },
            {
              "key": "timestampGreaterThanOrEqualTo",
              "value": "1962-12-02T08:38:26.979Z"
            },
            {
              "key": "timestampLessThan",
              "value": "1962-12-02T08:38:26.979Z"
            }
          ],
          "variable": [
            {
              "key": "alarmId"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "pariatur nostrud eiusmod",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
    },
    {
      "name": "An error has occurred.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Customer part of the request identifier token. If you need to contact Oracle about a particular\nrequest, please provide the complete request ID.\n",
            "key": "opc-request-id",
            "value": "pariatur nostrud eiusmod"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/alarms/:alarmId/history?alarmHistorytype=STATE_HISTORY&page=do ipsum&limit=576&timestampGreaterThanOrEqualTo=1962-12-02T08:38:26.979Z&timestampLessThan=1962-12-02T08:38:26.979Z",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "alarms",
            ":alarmId",
            "history"
          ],
          "query": [
            {
              "key": "alarmHistorytype",
              "value": "STATE_HISTORY"
            },
            {
              "key": "page",
              "value": "do ipsum"
            },
            {
              "key": "limit",
              "value": "576"
            },
            {
              "key": "timestampGreaterThanOrEqualTo",
              "value": "1962-12-02T08:38:26.979Z"
            },
            {
              "key": "timestampLessThan",
              "value": "1962-12-02T08:38:26.979Z"
            }
          ],
          "variable": [
            {
              "key": "alarmId"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "pariatur nostrud eiusmod",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact Oracle about\na particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"qui anim ut\",\n \"message\": \"esse proident\"\n}"
    }
  ]
}