Open
Description
@stephanie-engel commented on Fri Aug 07 2020
Description:
When referencing the swagger spec for /notificationRules/{ruleID}
, the PUT method returns a 400 error in regards to the endpointID
(notification endpoint id) that is provided via the original POST request.
Steps:
- Create a notification endpoint, for example:
curl --location --request POST 'http://gateway-main.se-cluster.svc.cluster.local:9999/api/v2/notificationEndpoints' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token myToken' \
--data-raw '{
"orgID": "0608b4ea5df7d000",
"description": "a great description",
"name": "ne name 66444",
"status": "active",
"type": "pagerduty",
"method": null,
"authMethod": null,
"url": "http://gateway-main.se-cluster.svc.cluster.local:9999/api/v2/ne-test",
"routingKey": "12345"
}'
- Get the
id
that was generated from the result and create a notification rule:
curl --location --request POST 'http://gateway-main.se-cluster.svc.cluster.local:9999/api/v2/notificationRules' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token myToken' \
--data-raw '{
"type":"http",
"orgID":"0608b4ea5df7d000",
"name":"postman created nr",
"status":"active",
"endpointID":"061a95ab0255b000",
"statusRules":[{"currentLevel":"INFO","period":"1h","count":1}],
"every":"10m"
}'
- Now attempt to update the notification rule via a PUT request:
curl --location --request PUT 'http://gateway-main.se-cluster.svc.cluster.local:9999/api/v2/notificationRules/null' \
--header 'Zap-Trace-Span: <string>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token myToken' \
--data-raw '{
"type":"pagerduty",
"every":"30s",
"orgID":"0608b4ea5df7d000",
"name":"totally rad nr",
"status":"inactive",
"endpointID":"061e9440d515b000", // this is the notification endpoint id that was generated in step 2
"statusRules":[{"currentLevel":"UNKNOWN","period":"1h","count":1}],
"description":"",
"messageTemplate":"blah"
}'
Results:
{
"code": "invalid",
"message": "id must have a length of 16 bytes"
}