Update quota rules

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

Update a quota rule defined for your organization by quota rule ID

You can update a specific quota rule for your organization by using a quota rule ID, as shown here.

Request

This example uses org123456789 as the realmId.

    PUT https://quota.bam.api.here.com/v1/realms/org123456789/rules/CUSTOMER-
QUOTA-db8ac3fb-f560-482c-a1e5-1626d503e4cd

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 200 OK

  {
    "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"
}

Update appId based quota rules

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

Request

       PUT https://quota.bam.api.here.com/v1/realms/org123456789/rules/CUSTOMER -QUOTA-
db8ac3fb-f560-482c-a1e5-1626d503e4cd

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"
      },
      {
        "key": "appId",
        "value": "appIDexample"
      }
    ],
    "usageThresholdCondition": {
      "thresholdType": "percentage",
      "threshold": 50,
      "usageLimit": 1000
    },
    "actions": [
      "alert"
    ],
    "timeRange": {
      "duration": "monthly"
    },
    "emailNotifications": [
      "example@here.com"
    ]
}

Response: HTTP 200 updated

{
  "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"
  },
  {
    "key": "appId",
    "value": "appIDexample"
  }
  ],
  "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 ""