younifyd
Menu

Create Rate Limiting Rule

Create a rate limiting rule.

POST/organizations/{organizationId}/zones/{zoneId}/rate-limiting/rules

Use it in a workflow

  1. Add a step and choose the Salesforce Commerce Cloud connector.
  2. Pick the Create Rate Limiting Rule action (under Zones (Data API)).
  3. Fill in the fields below, then reference the result from later steps as {{createRateLimitingRule.response.data}}.

Request

Path parameters

zoneIdstringrequired
organizationIdstringrequired

An identifier for the organization the request is being made by

Request body

Enter the body as JSON in the step's Body field.

descriptionstringrequired

The description of the rate limiting rule.

expressionstringrequired

The expression that defines when to evaluate the rate limiting rule.

characteristicsarray<string>required

Set of parameters defining how to group requests when tracking the request rate.

actionstringrequired

The action applied by the rate limiting rule. Valid actions are "block", "managed_challenge", "js_challenge", "legacy_captcha", and "log".

periodintegerrequired

The period of time to consider when evaluating the request rate (in seconds). Valid values are 10, 60, 120, 300, and 600.

requestsPerPeriodintegerrequired

The limit for the number of requests in the specified period of time.

mitigationTimeoutintegerrequired

After the rate is reached, the rate limiting rule applies the rule action to further requests for the period of time defined in this field (in seconds). When set to 0, the rule throttles requests over the maximum configured rate. When greater than 0, the action is presented for the selected duration after the configured rate is exceeded. Valid values are 0, 60, 120, 300, 600, 3600, and 86400.

countingExpressionstring

The expression that defines what kind of requests we want to rate limit.

enabledboolean

Whether or not the rate limiting rule is enabled.

positionobject

Used to specify the position of a rule.

beforestring

Insert the current rule before this ruleId.

afterstring

Insert the current rule after this ruleId.

json
{
  "description": "Rate limit /path1.",
  "expression": "(http.request.uri.path matches \"^/path1/.*\")",
  "characteristics": [
    "cf.unique_visitor_id"
  ],
  "action": "block",
  "period": 60,
  "requestsPerPeriod": 50,
  "mitigationTimeout": 600,
  "countingExpression": "(http.request.uri.path matches \"^/path1/.*\" and http.response.code eq 400)",
  "enabled": true,
  "position": {
    "before": "2c0fc9fa937b11eaa1b71c4d701ab86e",
    "after": "2c0fc9fa937b11eaa1b71c4d701ab86e"
  }
}

Response

Returns 201 with an object. Read it in later steps with {{createRateLimitingRule.response.data.<field>}}.

dataobject

A rate limiting rule.

ruleIdstringrequired

The ID of the rate limiting rule.

descriptionstringrequired

The description of the rate limiting rule.

expressionstringrequired

The expression that defines when to evaluate the rate limiting rule.

characteristicsarray<string>required

Set of parameters defining how to group requests when tracking the request rate.

actionstringrequired

The action applied by the rate limiting rule. Valid actions are "block", "managed_challenge", "js_challenge", "legacy_captcha", and "log".

periodintegerrequired

The period of time to consider when evaluating the request rate (in seconds). Valid values are 10, 60, 120, 300, and 600.

requestsPerPeriodintegerrequired

The limit for the number of requests in the specified period of time.

mitigationTimeoutintegerrequired

After the rate is reached, the rate limiting rule applies the rule action to further requests for the period of time defined in this field (in seconds). When set to 0, the rule throttles requests over the maximum configured rate. When greater than 0, the action is presented for the selected duration after the configured rate is exceeded. Valid values are 0, 60, 120, 300, 600, 3600, and 86400.

countingExpressionstring

The expression that defines what kind of requests we want to rate limit.

lastUpdatedstring (date-time)required

Date when the rate limiting rule was last updated.

enabledbooleanrequired

Whether or not the rate limiting rule is enabled.

json
{
  "data": {
    "ruleId": "2c0fc9fa937b11eaa1b71c4d701ab86e",
    "description": "Rate limit /path1.",
    "expression": "(http.request.uri.path matches \"^/path1/.*\")",
    "characteristics": [
      "cf.unique_visitor_id"
    ],
    "action": "block",
    "period": 60,
    "requestsPerPeriod": 50,
    "mitigationTimeout": 600,
    "lastUpdated": "2022-01-01T05:20:00Z",
    "enabled": true,
    "countingExpression": "(http.request.uri.path matches \"^/path1/.*\" and http.response.code eq 400)"
  }
}

Need more? See the Salesforce Commerce Cloud guide for connection setup and behaviour shared by every action.