Open
Description
@stephanie-engel commented on Fri Aug 07 2020
Description:
When referencing the swagger spec for notificationRules
, the POST method:
- does actually require the
tagRules
key (even though the spec indicates that the key is required) - the
every
key is required (but that is not indicated in the spec)
Steps:
In an Cloud2 instance:
tagRules
is present, but every
is missing:
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",
"tagRules":[],
"statusRules":[{"currentLevel":"INFO","period":"1h","count":1}]
}'
Returns a 500 error
{"code":"internal error","message":"unknown internal transaction error"}
but when every
is added :
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",
"tagRules":[],
"statusRules":[{"currentLevel":"INFO","period":"1h","count":1}],
"every":"10m"
}'
Response is 201 Created
{"id":"061e918cc595b000","name":"postman created nr","endpointID":"061a95ab0255b000","orgID":"0608b4ea5df7d000","ownerID":"0608b4ea4af7d000","every":"10m","runbookLink":"","statusRules":[{"currentLevel":"INFO","previousLevel":null}],"createdAt":"2020-08-07T18:57:16.054784724Z","updatedAt":"2020-08-07T18:57:16.054784724Z","type":"http","labels":[],"links":{"self":"/api/v2/notificationRules/061e918cc595b000","labels":"/api/v2/notificationRules/061e918cc595b000/labels","members":"/api/v2/notificationRules/061e918cc595b000/members","owners":"/api/v2/notificationRules/061e918cc595b000/owners","query":"/api/v2/notificationRules/061e918cc595b000/query"},"status":"active","latestCompleted":"2020-08-07T18:57:16Z","latestScheduled":"2020-08-07T18:57:16Z"}
Also tagRules
can be removed altogether and the POST still returns a success:
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"
}'
{"id":"061e91f37595b000","name":"postman created nr","endpointID":"061a95ab0255b000","orgID":"0608b4ea5df7d000","ownerID":"0608b4ea4af7d000","every":"10m","runbookLink":"","statusRules":[{"currentLevel":"INFO","previousLevel":null}],"createdAt":"2020-08-07T18:59:01.206301162Z","updatedAt":"2020-08-07T18:59:01.206301162Z","type":"http","labels":[],"links":{"self":"/api/v2/notificationRules/061e91f37595b000","labels":"/api/v2/notificationRules/061e91f37595b000/labels","members":"/api/v2/notificationRules/061e91f37595b000/members","owners":"/api/v2/notificationRules/061e91f37595b000/owners","query":"/api/v2/notificationRules/061e91f37595b000/query"},"status":"active","latestCompleted":"2020-08-07T18:59:01Z","latestScheduled":"2020-08-07T18:59:01Z"}
@stephanie-engel commented on Fri Aug 07 2020
This is happening in both OSS and Cloud 2