Uploaded image for project: 'Opsgenie'
  1. Opsgenie
  2. OPSGENIE-2359

The required body for PUT and POST calls to the Service / Incident Rules API (https://api.opsgenie.com/v1/services/:serviceId/incident-rules/:incidentRuleId) has changed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • Services - API
    • None

      Issue Summary

      This is reproducible across all instances, and is also documented in https://github.com/opsgenie/terraform-provider-opsgenie/issues/454

      Steps to Reproduce

      1. Call the https://api.opsgenie.com/v1/services/:serviceId/incident-rules/:incidentRuleId api with the payload detailed in the documentation on docs.opsgenie.com

       

      {
        "conditionMatchType": "match-all-conditions",
        "conditions": [{
            "expectedValue": "Incident",
            "operation": "contains",
            "not": false,
            "field": "message"
        }],
        "incidentProperties": {
            "message": "Incident Message",
            "description": "Incident Description",
            "tags": ["Tag1", "Tag2"],
            "priority": "P4",
            "stakeholderProperties": {
                "enable": true,
                "message": "Stakeholder Message",
                "description": "Stakeholder Description"
            }
        }
      } 

       

       

      Expected Results

      The API will perform as expected

      Actual Results

      The API returns a 422 error as it is expecting additional wrapping around the JSON body.

      Workaround

      Please place the incident rule body inside a new element incidentRule as detailed below: 

       

      {
       "incidentRule": {
        "conditionMatchType": "match-all-conditions",
        "conditions": [{
            "expectedValue": "Incident",
            "operation": "contains",
            "not": false,
            "field": "message"
        }],
        "incidentProperties": {
            "message": "Incident Message",
            "description": "Incident Description",
            "tags": ["Tag1", "Tag2"],
            "priority": "P4",
            "stakeholderProperties": {
                "enable": true,
                "message": "Stakeholder Message",
                "description": "Stakeholder Description"
            }
         }
        }
      } 

       

       

              2660845fa8cc Saikat Sarkar
              f7060889ab01 Scot Wilson
              Votes:
              8 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: