EDB Postgres Enterprise Manager REST APIs v14.0: Webhook v10.2

get__webhook_

Code samples

# You can also use wget
curl -X GET https://PEM-SERVER-IP/api/v14/webhook/ \
 -H 'Accept: application/json' \
 -H 'X-Auth-Token: string'
import requests
headers = {
 'Accept': 'application/json',
 'X-Auth-Token': 'string'
}
r = requests.get('https://PEM-SERVER-IP/api/v14/webhook/', headers = headers)
print(r.json())
const headers = {
 'Accept':'application/json',
 'X-Auth-Token':'string'
};
fetch('https://PEM-SERVER-IP/api/v14/webhook/',
{
 method: 'GET',
 headers: headers
})
.then(function(res) {
 return res.json();
}).then(function(body) {
 console.log(body);
});

GET /webhook/

Retrieve the webhook list.

Parameters

NameInTypeRequiredDescription
X-Auth-TokenheaderstringtrueToken of authorization

Example responses

200 Response
[
 {
 "id": 0,
 "name": "string",
 "url": "string",
 "enabled": true,
 "method": "POST",
 "http_headers": [
 {
 "http_header_id": 0,
 "http_header_key": "string",
 "http_header_value": "string"
 }
 ],
 "payload_template": "{'text': 'You have new alert from PEM', 'attachments': [{'text': 'AlertID \n%AlertID% \nAlertName \n%AlertName%''}]}",
 "low_alert": true,
 "med_alert": true,
 "high_alert": true,
 "cleared_alert": true,
 "payload_type": "ALERT"
 }
]

Responses

StatusMeaningDescriptionSchema
200OK Status 200Inline

Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
anonymous[Webhook]falsenonenone
» idintegerfalsenoneWebhook ID
» namestringfalsenoneWebhook name
» urlstringfalsenoneWebhook URL
» enabledbooleanfalsenoneDetermines whether the webhook is enabled.
» methodstringfalsenoneRequest method
» http_headers[WebhookGetHTTPHeaders]falsenoneList of the HTTP header key/value pairs to be used by the webhook
»» http_header_idintegerfalsenoneID of the HTTP header
»» http_header_keystringfalsenoneName of the HTTP header key
»» http_header_valuestringfalsenoneName of the HTTP header key
» payload_templatestringfalsenonePayload template. Below is payload example for slack.
» low_alertbooleanfalsenoneDetermines whether the low alert is enabled.
» med_alertbooleanfalsenoneDetermines whether the medium alert is enabled.
» high_alertbooleanfalsenoneDetermines whether the high alert is enabled.
» cleared_alertbooleanfalsenoneDetermines whether the cleared alert is enabled.
» payload_typestringfalsenonePayload type
Enumerated Values
PropertyValue
methodPOST
methodPUT
payload_typeALERT
payload_typeJOB
Info

This operation does not require authentication

post__webhook_

Code samples

# You can also use wget
curl -X POST https://PEM-SERVER-IP/api/v14/webhook/ \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: string'
import requests
headers = {
 'Content-Type': 'application/json',
 'X-Auth-Token': 'string'
}
r = requests.post('https://PEM-SERVER-IP/api/v14/webhook/', headers = headers)
print(r.json())
const inputBody = '{
 "name": "string",
 "url": "string",
 "enabled": true,
 "method": "POST",
 "http_headers": [
 {
 "http_header_key": "string",
 "http_header_value": "string"
 }
 ],
 "payload_template": "{ 'Alert Name':'%AlertName%'','type':'Webhook' }",
 "low_alert": true,
 "med_alert": true,
 "high_alert": true,
 "cleared_alert": true,
 "payload_type": "ALERT"
}';
const headers = {
 'Content-Type':'application/json',
 'X-Auth-Token':'string'
};
fetch('https://PEM-SERVER-IP/api/v14/webhook/',
{
 method: 'POST',
 body: inputBody,
 headers: headers
})
.then(function(res) {
 return res.json();
}).then(function(body) {
 console.log(body);
});

POST /webhook/

Add a new webhook.

Body parameter

{
 "name": "string",
 "url": "string",
 "enabled": true,
 "method": "POST",
 "http_headers": [
 {
 "http_header_key": "string",
 "http_header_value": "string"
 }
 ],
 "payload_template": "{ 'Alert Name':'%AlertName%'','type':'Webhook' }",
 "low_alert": true,
 "med_alert": true,
 "high_alert": true,
 "cleared_alert": true,
 "payload_type": "ALERT"
}

Parameters

NameInTypeRequiredDescription
X-Auth-TokenheaderstringtrueToken of authorization
bodybodyWebhookPostData truenone

Example responses

Responses

StatusMeaningDescriptionSchema
200OK Webhook created successfully.None

Response Schema

Info

This operation does not require authentication

get__webhook_{webhook_id}

Code samples

# You can also use wget
curl -X GET https://PEM-SERVER-IP/api/v14/webhook/{webhook_id} \
 -H 'Accept: application/json' \
 -H 'X-Auth-Token: string'
import requests
headers = {
 'Accept': 'application/json',
 'X-Auth-Token': 'string'
}
r = requests.get('https://PEM-SERVER-IP/api/v14/webhook/{webhook_id}', headers = headers)
print(r.json())
const headers = {
 'Accept':'application/json',
 'X-Auth-Token':'string'
};
fetch('https://PEM-SERVER-IP/api/v14/webhook/{webhook_id}',
{
 method: 'GET',
 headers: headers
})
.then(function(res) {
 return res.json();
}).then(function(body) {
 console.log(body);
});

GET /webhook/{webhook_id}

Retrieve information for the webhook, identified by the webhook_id.

Parameters

NameInTypeRequiredDescription
webhook_idpathstringtruenone
X-Auth-TokenheaderstringtrueToken of authorization

Example responses

200 Response
{
 "id": 0,
 "name": "string",
 "url": "string",
 "enabled": true,
 "method": "POST",
 "http_headers": [
 {
 "http_header_id": 0,
 "http_header_key": "string",
 "http_header_value": "string"
 }
 ],
 "payload_template": "{'text': 'You have new alert from PEM', 'attachments': [{'text': 'AlertID \n%AlertID% \nAlertName \n%AlertName%''}]}",
 "low_alert": true,
 "med_alert": true,
 "high_alert": true,
 "cleared_alert": true,
 "payload_type": "ALERT"
}

Responses

StatusMeaningDescriptionSchema
200OK Status 200Webhook
Info

This operation does not require authentication

put__webhook_{webhook_id}

Code samples

# You can also use wget
curl -X PUT https://PEM-SERVER-IP/api/v14/webhook/{webhook_id} \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: string'
import requests
headers = {
 'Content-Type': 'application/json',
 'X-Auth-Token': 'string'
}
r = requests.put('https://PEM-SERVER-IP/api/v14/webhook/{webhook_id}', headers = headers)
print(r.json())
const inputBody = '{
 "name": "string",
 "url": "string",
 "enabled": true,
 "method": "POST",
 "http_headers": {
 "added": [
 {
 "http_header_key": "string",
 "http_header_value": "string"
 }
 ],
 "changed": [
 {
 "http_header_id": 0,
 "http_header_key": "string",
 "http_header_value": "string"
 }
 ],
 "deleted": [
 {
 "http_header_id": 0
 }
 ],
 "payload_type": "ALERT"
 },
 "payload_template": "{'text': 'You have new alert from PEM', 'attachments': [{'text': 'AlertID \n%AlertID% \nAlertName \n%AlertName%''}]}",
 "low_alert": true,
 "med_alert": true,
 "high_alert": true,
 "cleared_alert": true
}';
const headers = {
 'Content-Type':'application/json',
 'X-Auth-Token':'string'
};
fetch('https://PEM-SERVER-IP/api/v14/webhook/{webhook_id}',
{
 method: 'PUT',
 body: inputBody,
 headers: headers
})
.then(function(res) {
 return res.json();
}).then(function(body) {
 console.log(body);
});

PUT /webhook/{webhook_id}

Update the webhook information.

Body parameter

{
 "name": "string",
 "url": "string",
 "enabled": true,
 "method": "POST",
 "http_headers": {
 "added": [
 {
 "http_header_key": "string",
 "http_header_value": "string"
 }
 ],
 "changed": [
 {
 "http_header_id": 0,
 "http_header_key": "string",
 "http_header_value": "string"
 }
 ],
 "deleted": [
 {
 "http_header_id": 0
 }
 ],
 "payload_type": "ALERT"
 },
 "payload_template": "{'text': 'You have new alert from PEM', 'attachments': [{'text': 'AlertID \n%AlertID% \nAlertName \n%AlertName%''}]}",
 "low_alert": true,
 "med_alert": true,
 "high_alert": true,
 "cleared_alert": true
}

Parameters

NameInTypeRequiredDescription
webhook_idpathstringtruenone
X-Auth-TokenheaderstringtrueToken of authorization
bodybodyWebhookPutData truenone

Example responses

Responses

StatusMeaningDescriptionSchema
200OK Webhook updated successfully.None

Response Schema

Info

This operation does not require authentication

delete__webhook_{webhook_id}

Code samples

# You can also use wget
curl -X DELETE https://PEM-SERVER-IP/api/v14/webhook/{webhook_id} \
 -H 'X-Auth-Token: string'
import requests
headers = {
 'X-Auth-Token': 'string'
}
r = requests.delete('https://PEM-SERVER-IP/api/v14/webhook/{webhook_id}', headers = headers)
print(r.json())
const headers = {
 'X-Auth-Token':'string'
};
fetch('https://PEM-SERVER-IP/api/v14/webhook/{webhook_id}',
{
 method: 'DELETE',
 headers: headers
})
.then(function(res) {
 return res.json();
}).then(function(body) {
 console.log(body);
});

DELETE /webhook/{webhook_id}

Delete the webhook.

Parameters

NameInTypeRequiredDescription
webhook_idpathstringtruenone
X-Auth-TokenheaderstringtrueToken of authorization

Example responses

Responses

StatusMeaningDescriptionSchema
200OK Webhook deleted successfullyNone

Response Schema

Info

This operation does not require authentication