-
Suggestion
-
Resolution: Unresolved
-
None
When querying the Heartbeats, you can either list all heartbeats or get one heartbeat.
Getting one heartbeat is described here: https://docs.opsgenie.com/docs/heartbeat-api#get-heartbeat-request
As you can see, the payload in the example is below. Although it's not mentioned in the documentation, we can see in the JSON the lastPingTime is present.
{ "data": { "name": "HeartbeatName", "description": "Sample heartbeat description", "interval": 10, "enabled": true, "intervalUnit": "minutes", "expired": true, "ownerTeam": { "id": "6c7be998-fad9-4491-a9a7-d99alp4c0ae5", "name": "ops_team" }, "alertMessage": "HeartbeatName is expired", "alertTags": ["heartbeatTag1","heartbeatTag2"], "alertPriority" : "P3" }, "took": 0, "requestId": "9bc9e05b-2f07-44b3-9be0-cb0ec0c45533" }
When our customers runs the following curl command:
curl --request GET --url https://api.eu.opsgenie.com/v2/heartbeats/HEARTBEAT_NAME --header 'Authorization: GenieKey <my-API-key>' and they got the following result:
{ "data": { "name": "name", "description": "description", "ownerTeam": { "id": "ID", "name": "name" }, "interval": 13, "enabled": true, "intervalUnit": "minutes", "expired": false, "lastPingTime": "2025-02-20T14:00:05.533Z", "alertMessage": "[CMK] [AVS-24x7] Opsgenie HTTPS Heartbeat from ExotrackNG Site AVS01 is expired", "alertTags": [ ], "alertPriority": "P1" }, "took": 0.014, }
Is it possible to update the documentation to reflect this?
Another additional suggestion is making this(lastPingedTime) information available when making an API request to list all the heartbeats.
This would be quicker (and less “load intensive”) to get the information. Currently customers would have to list all heartbeats (1 request) and then query each heartbeat (from the names received in the previous request) to get the LastPingTime. That’s N more requests, with N being the number of heartbeats received in the list…