I have webhook code that has worked just fine for a while, but it's now throwing an exception based on an Internal Server Error code. Does this suggest there's an issue on my end or on the server's end?
Here's the relevant code:
def webhookHttp(url, jsonBody, type=null, ctrlId) {
if (debugLogging) { log.debug "webhookHttp($url, $jsonBody, $type, $ctrlId)" }
def response = null
def cmdParams = [
uri: url,
requestContentType: "application/x-www-form-urlencoded; charset=utf-8",
headers: ["Authorization": "Bearer ${atomicState?.authToken}", "Content-Type": "application/json"],
body: jsonBody
]
try {
if(type == "post") {
httpPost(cmdParams) { resp ->
response = resp
}
}
else if(type == "put") {
httpPut(cmdParams) { resp ->
response = resp
}
}
else if(type == "delete") {
httpDelete(cmdParams) { resp ->
response = resp
}
}
} catch(Exception e) {
log.error "webhookHttp Exception Error: ${e.message}"
}
}
Here's the debug output:
> app:7062020-09-11 12:46:26.135 pm error webhookHttp Exception Error: Internal Server Error
> app:7062020-09-11 12:46:25.579 pm debug webhookHttp(https://api.rach.io/1/public/notification/webhook, {"id":["XXXXX"],"externalId":"Rachio Community","url":"https://cloud.hubitat.com/api/XXXXXX","eventTypes":[{"id":"5"},{"id":"10"},{"id":"9"}]}, put, XXXXXX)
Here's the API definition
Definition
https://api.rach.io/1/public/notification/webhook
Examples
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer 8e600a4c-0027-4a9a-9bda-dc8d5c90350d" -d '{ "id":"79667c29-bd07-428d-9c29-23e18b023978", "externalId" : "external company ID", "url":"https://www.mydomain.com/another_webhook_new_url","eventTypes":[{"id":"1"},{"id":"2"}]}' https://api.rach.io/1/public/notification/webhook
Result Format
HTTP/1.1 200 OK { "createDate": 1416877798305, "id": "79667c29-bd07-428d-9c29-23e18b023978", "url": "https://www.mydomain.com/another_webhook", "externalId" : "external company ID", "eventTypes": [ { "createDate": 1416544265115, "lastUpdateDate": 1416544265115, "id": 1, "name": "SCHEDULE_ACTION", "description": "A schedule action has occurred", "type": "WEBHOOK" }, { "createDate": 1416544265115, "lastUpdateDate": 1416544265115, "id": 2, "name": "ZONE_ACTION", "description": "A zone action has has occurred", "type": "WEBHOOK" } ] }