Adjustment Rules API

The purpose of this API is to create, update and delete adjustment rules. Refer to the Adjustment Rules and Surcharge Rules chapter of the Premium and Fee Configuration implementation guide for more information on the related model.

Adjustment Rules

The resource adjustmentrules can be accessed using GET on:

http://<hostname>:<port>/<contextRoot>/generic/adjustmentrules

The section "Discoverability" in [Concepts] describes how to discover a collection resource from the root URI.

Get on the above url will return adjustment rules for each schedule definition of type adjustment, group adjustment and surcharge

Example payload:

{
  "items":[
    {
      "name": <schedule definition code>,
      "type":<type of schedule definition>
      "links": [
        {
          "href": "http://<hostname>:<port>/<contextRoot>/generic/adjustmentrules/<schedule definition code>",
          "rel": "canonical"
        },
        {
         "href": "http://<hostname>:<port>/<contextRoot>/generic/adjustmentrules/<schedule definition code>/definition",
         "rel": "oi:definition"
        }
       .... Other links like create form, edit form etc.
      ]
    },
    ...
  ]
}

The payloads presented in this section are just examples. Please use the Swagger metadata to find out what all is possible.

The "oi:definition" has the usual functionality. Instead of returning the internal datamodel, it however represents the definition of the dimensions as defined by the schedule. For example, when an adjustment is based on schedule definition MED_COND that has a medicalCondition (alphanumeric) dimension, then the link of type "oi:definition" returns:

{
  "MED_COND": {
    "type": "object",
    "properties": {
      "amount": {
        "type": "object",
        "properties": {
          "value": {
            "type": "number",
            "xml": {
              "attribute": true
            },
            "minimum": -9999999999.9999,
            "maximum": 9999999999.9999
          }
        }
      },
      "functionDynamicLogic": {
        "$ref": "http://<hostname>:<port>/<contextRoot>/generic/dynamiclogic/definition"
      },
      "functionDynamicLogicNotProrated": {
        "$ref": "http://<hostname>:<port>/<contextRoot>/generic/dynamiclogic/definition"
      },
      "percentage": {
        "type": "number",
        "xml": {
          "attribute": true
        },
        "minimum": -999.9999,
        "maximum": 999.9999
      },
     "medicalCondition": {
        "type": "string",
        "xml": {
          "attribute": true
        },
        "maxLength": 1000
      }
    }
  }
}

In general, the definition resource is like this:

{
  "type": "object",
  "properties": {
    "amount": {
      "type": "object",
      "properties": {
        "value": {
          "type": "number",
          "xml": {
            "attribute": true
          },
          "minimum": -9999999999.9999,
          "maximum": 9999999999.9999
        }
      }
    },
    "functionDynamicLogic": {
      "$ref": "http://<hostname>:<port>/<contextRoot>/generic/dynamiclogic/definition"
    },
    "functionDynamicLogicNotProrated": {
      "$ref": "http://<hostname>:<port>/<contextRoot>/generic/dynamiclogic/definition"
    },
    "percentage": {
      "type": "number",
      "xml": {
        "attribute": true
      },
      "minimum": -999.9999,
      "maximum": 999.9999
    },
   "<amountField>": {
      "type": "object",
      "properties": {
        "currency": {
          "type": "string",
          "xml": {
            "attribute": true
          }
        },
        "valueAmount": {
          "type": "number",
          "xml": {
            "attribute": true
          },
          "minimum": -9999999999.9999,
          "maximum": 9999999999.9999
        }
      }
    },
    "<charField>": {
      "type": "string",
      "xml": {
        "attribute": true
      },
      "maxLength": 1000
    },
    "<charFlexCodeField>": {
      "type": "string",
      "xml": {
        "attribute": true
      },
      "maxLength": 1000,
      "x-oi-dyn-flex-link": "<URL>"
    },
    "<charRangeField>": {
      "type": "object",
      "properties": {
        "valueFrom": {
          "type": "string",
          "xml": {
            "attribute": true
          },
          "maxLength": 1000
        },
        "valueTo": {
          "type": "string",
          "xml": {
            "attribute": true
          },
          "maxLength": 1000
        }
      }
    },
    "<dateField>": {
      "type": "string",
      "format": "date",
      "xml": {
        "attribute": true
      }
    },
    "<numberField>": {
      "type": "number",
      "xml": {
        "attribute": true
      }
    }
  }
}

The collection resource for adjustment rules for a schedule definition can be accessed using GET on:

http://[hostName]:[portNumber]/[api-context-root]/generic/adjustmentrules/<schedule definition code>

GET on the above url will return links to maintain adjustment rules (of a schedule) for each default time period. Sample payload

{
  "items":[
    {
      "startDate": "<startDate of default time period 1>",
      "links": [
        {
          "href": "http://<hostname>:<port>/<contextRoot>/generic/adjustmentrules/<schedule definition code]/defaulttimeperiod/[defaultTimePeriodStartDate 1]",
          "rel": "canonical"
        }]
    },
    {
      "startDate": "<startDate of default time period 2>",
      "links": [
        {
          "href": "http://<hostname>:<port>/<contextRoot>/generic/adjustmentrules/<schedule definition code>/defaulttimeperiod/[defaultTimePeriodStartDate 2]",
          "rel": "canonical"
        }]
    }
  ]
}

The resource representation has links for each defined default time period. Those links can be followed to retrieve, create, update or delete rules for that time period and schedule definition. For more details, see sections below.

Accessing Adjustment Rules through Schedule Definition API

The resource representation of the resource schedule definition has a property "adjustmentRuleList" with links for each defined default time period. Those links can be followed to retrieve, create, update or delete rules for that time period and adjustment rules. An adjustment rule or a surcharge rule is both referred to as Adjustment Rule at the entity level. For details on model, refer to the chapter Data Model - Adjustment and Surcharge Rules in the Premium and Fees Configuration guide.

"scheduledefinition": {
  "type": "object",
  "required": [
    "code",
    "descr",
    "enabled",
    "type"
  ],
  "properties": {
  ....
    "adjustmentRuleList":[
      {
        "startDate": "<startDate of default time period 1>",
        "links": [
          {
            "href": "http://<hostname>:<port>/<contextRoot>/generic/adjustmentrules/<schedule definition code>/defaulttimeperiod/<defaultTimePeriodStart 1>",
            "rel": "canonical"
          }]
    },
    {
      "startDate": "<startDate of default time period 2>",
      "links": [
        {
          "href": "http://<hostname>:<port>/<contextRoot>/generic/adjustmentrules/<schedule definition code>/defaulttimeperiod/<defaultTimePeriodStartDate 2>",
          "rel": "canonical"
        }]
      }]
    }
  }
}

Retrieve Adjustment Rules

Existing rules can be retrieved using the GET operation against the URL found within the context of the schedule definition and the applicable default time period.

{
  "items": [{
      "id":"1",
     "amount": {
        "value": 15
        "currency":"USD"
      },
      "age": {
        "valueFrom": 18,
        "valueTo": 99
      },
      "medicalCondition": "N"
      .... Other attributes ....
      "links": [
        {
          "href": "http://<hostname>:<port>/<contextRoot>/generic/adjustmentrules/<schedule definition code>/defaulttimeperiod/<defaultTimePeriodStartDate 1>",
          "rel": "self"
        }
      ]
    }
    {
      "id":2
      "amount": {
        "value": 20"
        "currency: "USD"
      },
      "age": {
        "valueFrom": 18,
        "valueTo": 99
      },
      "medicalCondition": "Y"
       .... Other attributes ....
      "links": [
        {
          "href": "http://<hostname>:<port>/<contextRoot>/generic/adjustmentrules/<schedule definition code>/defaulttimeperiod/<defaultTimePeriodStartDate 2>",
          "rel": "self"
        }
      ]
    }
  ]
}

Add, update and delete adjustment rules

One has to retrieve the URL of the adjustment rules within the context of schedule definition and default time period, for example using a GET operation. Use the entry with the "startDate" matching the default time period to be processed.

  • With POST operation an adjustment rule can be added to the schedule definition within the context of default time period

  • With Collection PATCH, one can do operations (add, update, delete) on multiple rules that belong to a schedule definition and default time period

  • With PUT, PATCH an adjustment rule can be updated

  • With DELETE operation an adjustment rule can be deleted

The message format for POST/PUT/PATCH:

{
  "amount": {
    "value": ""
  },
  "percentage": "",
  "functionDynamicLogic": {
    "id": ""
  },
  "functionDynamicLogicNotProrated": {
    "id": ""
  },
  "<field name of schedule dimension with type value and datatype other than amount>": "",
  "<field name of schedule dimension with type value and datatype amount>": {
    "valueAmount": {
      "value": "",
      "currency": ""
    }
  },
  "<field name of schedule dimension with type range and datatype other than amount>": {
    "valueFrom": "",
    "valueTo": ""
  },
  "<field name of schedule dimension with type range and datatype amount>": {
    "valueFromAmount": {
      "value": "",
      "currency": ""
    },
    "valueToAmount": {
      "value": "",
      "currency": ""
    }
  }
}

Collection PATCH payload

Example payload for inserting 2 adjustment rules:

{
  "items": [{
      "op": "add"
      "amount": {
        "value": 15
        "currency":"USD"
      },
      "age": {
        "valueFrom": 18,
        "valueTo": 99
      },
      "medicalCondition": "N"
    }
    {
      "op": "add"
      "amount": {
        "value": 20"
        "currency: "USD"
      },
      "age": {
        "valueFrom": 18,
        "valueTo": 99
      },
      "medicalCondition": "Y"
    }
  ]
}

See HTTP API PATCH for more details about "op". Collection PATCH uses the technical id of the adjustment rule to match the payload with existing data.

For details on how values in the request messages are handled, Property Representation and Handling (PUT, POST, PATCH).
This API uses HTTP status codes as defined in Response Messages.