Update Settings on All PagerDuty Services
Update acknowledgement_timeout and auto_resolve_timeout parameters on all PagerDuty services
by Ryan Hoskin
HTML
<script src="https://eurica.github.io/pdjs/js/pdjs.js"></script>
<div id="services"></div>
JavaScript
//Update acknowledgement_timeout and auto_resolve_timeout parameters on all PagerDuty services
PDJS = new PDJSobj({
subdomain: "pdt-ryan",
token: "dhN9NYhHm4zpB1LppS2s",
})
update_service = function (service_id) {
PDJS.api ({
res: "services/" + service_id,
type: "PUT",
data: {
acknowledgement_timeout: "3600",
auto_resolve_timeout: "86400"
},
success: function(json) {
$("#services").append(json)
}
})
}
PDJS.api_all({
res: "services",
data: {
},
final_success: function(data) {
jQuery.each(data.services, function(index, service) {
$("#services").append(service.id+"<br/>");
$("#services").append(service.name+"<br/>");
update_service(service.id);
})
},
incremental_success: function(data) {
console.log("Got data");
}
})