Discussion

Unit group tier rates control the rate for units in the same unit group and tier. When you are setting this up, you will need to have tiering enabled.

See the Unit Groups section of the docs for more information on Unit Groups.

See the Tiers section of the docs for more information on Tiers.


PUT /v1/:facility_id/unit_group_tier_rates/update
Updates or creates one or many unit group tier rates

Discussion

Use this endpoint to update or create one or many unit group tier rates. You must provide a positive integer for the rate. You must provide a valid Unit Group ID and Tier ID to create or update a unit group tier rate.

You can retrieve a list of valid unit groups by using the GET unit_groups endpoint. You can retrieve a list of valid tiers using the GET tiers endpoint.

If a unit group and tier have already been associated, the rate will be updated. If a unit group and tier have not been associated, a new unit group tier rate will be created.

Example Payload

{
  "unit_group_tier_rates": [
    {
      "rate": 30,
      "tier_id": "b62e40fa-0a6a-453f-85d5-135b7968198c",
      "unit_group_id": "551520fa-462b-4edd-a425-eb6d49ca1390",
    }
  ]
}

Example Response

{
    "unit_group_tier_rates": [
        {
            "id": "dc0083d1-e931-4673-a529-2e359db9b717",
            "rate": 30.0,
            "tier_id": "b62e40fa-0a6a-453f-85d5-135b7968198c",
            "unit_group_id": "551520fa-462b-4edd-a425-eb6d49ca1390"
        }
    ],
    "meta": {
        "status_code": 200,
        "status_message": "OK",
        "status_cat": "https://http.cat/200",
        "request_method": "PUT",
        "request_id": "117d8d56-fe1f-4bc9-955f-2b002e968ce3",
        "parameters": {
            "unit_group_tier_rates": [
                {
                    "tier_id": "b62e40fa-0a6a-453f-85d5-135b7968198c",
                    "unit_group_id": "551520fa-462b-4edd-a425-eb6d49ca1390",
                    "rate": 3
                }
            ],
            "facility_id": "de96cc43-7c5d-419e-abcd-17e023c31b54",
            "unit_group_tier_rate": {}
        }
    }
}

Errors

Code Description
400 Record(s) with invalid rate: <unit_group_tier_rate>
404 Tier(s) not found: <tier_id>
404 Unit Group(s) not found: <unit_group_id>

Params

Param name Description
unit_group_tier_rates
required

A collection of attributes to update or create a unit group tier rate. These rates will only be used by facilities with tiering enabled.

Validations:

  • Must be an Array of nested elements

unit_group_tier_rates[tier_id]
required

ID of the associated tier

Validations:

  • Must be a String

unit_group_tier_rates[unit_group_id]
required

ID of the associated unit group

Validations:

  • Must be a String

unit_group_tier_rates[rate]
required

The new rate for the unit group/tier association

Validations:

  • Must be a Float


GET /v1/:facility_id/unit_group_tier_rates
Show all unit group tier rates for a facility

Params

Param name Description
unit_group_id
optional

Id of a unit group. If present, will filter results to the rates for the provided unit group. Otherwise returns all rates for the facility.

Validations:

  • Must be a String