rule type
, name
, description
, urgency level
, and assigned responders (e.g., teams).team
and organisation
, showing rules defined at different levels of your environment.const axios = require('axios');
const url = "https://incident-query.api.pinghome.io/v1/rulesets";
axios.get(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
type
of rule (e.g., state-change
), an array of conditions
, the target team_id
or assignees
, urgency
level, and a descriptive name
and description
for context.const axios = require('axios');
const url = 'https://incident-cmd.api.pinghome.io/v1/ruleset';
const data = {
rule_type: 'state-change',
conditions: [{ values: ['10'], operator: 'equal', type: 'json-check', key: 'products[0].count' }],
level: 'team',
team_id: 'c03b02ec-244f-4d2c-8f68-3910071ed5c8',
name: 'Name',
description: 'Description',
urgency: 'medium',
assignees: [{ type: 'team', id: '445a5c1f-c0eb-403a-96d7-3976e5dc74ed' }]
};
axios.post(url, data, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
ruleset_id
in the path and submitting the updated rule configuration in the request body. You can modify fields such as the type
of the rule (e.g., state-change
), the list of conditions
, urgency
, description
, name
, and assigned assignees
(e.g., team IDs).const axios = require('axios');
const url = 'https://incident-cmd.api.pinghome.io/v1/ruleset/c03b02ec-244f-4d2c-8f68-3910071ed5c8';
const data = {
rule_type: 'state-change',
conditions: [{ values: ['10'], operator: 'equal', type: 'json-check', key: 'products[0].count' }],
level: 'team',
team_id: 'c03b02ec-244f-4d2c-8f68-3910071ed5c8',
name: 'Name',
description: 'Description',
urgency: 'medium',
assignees: [{ type: 'team', id: '445a5c1f-c0eb-403a-96d7-3976e5dc74ed' }]
};
axios.put(url, data, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
ruleset_id
in the path. Once removed, the ruleset will no longer trigger incidents based on its defined conditions.const axios = require('axios');
const url = 'https://incident-cmd.api.pinghome.io/v1/ruleset/c03b02ec-244f-4d2c-8f68-3910071ed5c8';
axios.delete(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
ruleset_id
in the path. Each action defines what automated task should be executed when the ruleset conditions are met — such as updating a status page component or triggering a downstream system.action type
(e.g., trigger-statuspage-update
) and nested settings
that specify the source
(e.g., a resource ID being monitored), the target
(such as a status page component), and the parent
entity (e.g., the linked status page).const axios = require('axios');
const url = "https://incident-query.api.pinghome.io/v1/ruleset/c03b02ec-244f-4d2c-8f68-3910071ed5c8/actions";
axios.get(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
ruleset_id
in the path and submitting the updated actions
array in the request body. Each action includes a type
(such as trigger-statuspage-update
) and corresponding settings
.const axios = require('axios');
const url = 'https://incident-cmd.api.pinghome.io/v1/ruleset/445a5c1f-c0eb-403a-96d7-3976e5dc74ed/actions';
const data = {
actions: [
{
type: 'trigger-alerts',
settings: [
{
status_page_id: '445a5c1f-c0eb-403a-96d7-3976e5dc74ed',
component_id: '445a5c1f-c0eb-403a-96d7-3976e5dc74ed'
}
]
}
]
};
axios.put(url, data, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
name
, description
, enabled
status, the URL
to which events should be sent, and the created_at
timestamp.const axios = require('axios');
const url = "https://incident-query.api.pinghome.io/v1/webhooks";
axios.get(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
webhook_id
in the path. Each event represents a payload submitted to the webhook endpoint — typically from an external system or alerting service.content_type
of the payload, the raw body
of the received request, the sender’s IP address
, and the received_at
timestamp.last_received_at
and limit
to paginate results and retrieve only the most recent entries.const axios = require('axios');
const url = "https://incident-query.api.pinghome.io/v1/webhook/c03b02ec-244f-4d2c-8f68-3910071ed5c8/events?limit=10&last_received_at=2024-03-15T19:09:39Z";
axios.get(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
name
, description
. After creation, the webhook’s unique id
will be returned in the response. This ID can be used to programmatically submit event payloads to the webhook via the Submit Webhook Event endpointconst axios = require('axios');
const url = 'https://incident-cmd.api.pinghome.io/v1/webhook';
const data = {
name: "Webhook name",
description: "Webhook description"
};
axios.post(url, data, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
webhook_id
in the path. This ID is returned when a webhook is created via the Create Webhook endpoint.const axios = require('axios');
const url = 'https://data-gateway.api.pinghome.io/v1/incident/webhook/{id}';
const data = {
example_key: 'example_value'
};
axios.post(url, data, {
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});