Create quota rules

The tutorial in this section shows you how to create quota rules.

Create appId based quota rules

The following explains app ID based rules. This rule example suspends access to appId app1 for the autosuggest API, if the app1 usage for the autosuggest API exceeds 1000 requests.

Request

This example uses org123456789 as the realmId.

       POST https://quota.bam.api.here.com/v1/realms/org123456789/rules

Request body

{
  "name": "Location Service destination weather app alert usage on 500 transactions ",
  "description": "Alert when the destination weather API usage on 1000 transactions ",
  "status": "active",
  "queryConditions": [
    {
      "key": "featureId",
      "value": "hrn:here:service::olp-here:destination-weather-3:standard"
    }
  ],
  "usageThresholdCondition": {
    "thresholdType": "percentage",
    "threshold": 50,
    "usageLimit": 1000
  },
  "actions": [
    "alert"
  ],
  "timeRange": {
    "duration": "monthly"
  },
  "emailNotifications": [
    "example@here.com"
  ]
 }

Response: HTTP 201 Created

{
  "ruleId": "CUSTOMER-QUOTA-9d9e247a-4c06-483c-9514-77c20ebf4beb",
  "hrn": "hrn:here-dev:quota::org123456789:CUSTOMER-QUOTA-9d9e247a-4c06-483c-9514-77c20ebf4beb",
  "name": "Location Service destination weather app alert usage on 500 transactions",
  "description": "Alert when the destination weather API usage on 1000 transactions ",
  "status": "active",
  "queryConditions": [
    {
      "key": "featureId",
      "value": "hrn:here:service::olp-here:destination-weather-3:standard "
    }
  ],
  "usageThresholdCondition": {
    "thresholdType": "percentage",
    "threshold": 50,
    "usageLimit": 1000
  },
  "actions": [
    "alert"
  ],
  "timeRange": {
    "duration": "monthly"
  },
  "ruleType": "alert",
  "quotaReferenceId": "QUOTA-dd2fe6a9-075f-4be4-9721-e58de19b2ee7",
  "quotaRuleReferenceId": "QUOTA-RULE-f73559dd-2aee-4f09-b129-5c0d2472324a",
  "created": "2021-09-22T16:48:41",
  "modified": "2021-09-22T16:52:05",
  "createdBy": "system",
  "updatedBy": "system"
}

results matching ""

    No results matching ""