Ana içeriğe atla

Overview

Adds API endpoints to an existing RLCL. Endpoints added to the RLCL will be subject to the rate limiting rules defined in the RLCL.

Endpoint

POST /apiops/projects/{projectName}/rlcl/{rlclName}/endpoints/

Authentication

Requires a Personal API Access Token.
Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer Yes
Content-Typeapplication/jsonYes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
rlclNamestringYesRLCL name

Request Body

Full JSON Body Example - Single Endpoint

{
  "endpointRateLimitList": [
    {
      "apiProxyName": "MyAPI",
      "endpointName": "/users",
      "endpointHTTPMethod": "GET",
      "permittedMessageCount": 100,
      "timeIntervalPeriodLength": 1,
      "timeInterval": "ONE_MINUTE",
      "cacheConnectionTimeoutInSeconds": 3,
      "cacheErrorHandlingType": "FAIL",
      "timeIntervalWindowType": "FIXED",
      "showRateLimitStatisticsInResponseHeader": false,
      "enabled": true
    }
  ]
}

Full JSON Body Example - Multiple Endpoints

{
  "endpointRateLimitList": [
    {
      "apiProxyName": "MyAPI",
      "endpointName": "/users",
      "endpointHTTPMethod": "GET",
      "permittedMessageCount": 100,
      "timeIntervalPeriodLength": 1,
      "timeInterval": "ONE_MINUTE",
      "cacheConnectionTimeoutInSeconds": 3,
      "cacheErrorHandlingType": "FAIL",
      "timeIntervalWindowType": "FIXED",
      "showRateLimitStatisticsInResponseHeader": false,
      "enabled": true
    },
    {
      "apiProxyName": "MyAPI",
      "endpointName": "/orders",
      "endpointHTTPMethod": "POST",
      "permittedMessageCount": 50,
      "timeIntervalPeriodLength": 1,
      "timeInterval": "ONE_MINUTE",
      "cacheConnectionTimeoutInSeconds": 3,
      "cacheErrorHandlingType": "FAIL",
      "timeIntervalWindowType": "SLIDING",
      "showRateLimitStatisticsInResponseHeader": true,
      "enabled": true
    }
  ]
}

Full JSON Body Example - All Endpoints

{
  "endpointRateLimitList": [
    {
      "apiProxyName": "MyAPI",
      "endpointName": "ALL",
      "endpointHTTPMethod": "ALL",
      "permittedMessageCount": 200,
      "timeIntervalPeriodLength": 1,
      "timeInterval": "ONE_HOUR",
      "cacheConnectionTimeoutInSeconds": 3,
      "cacheErrorHandlingType": "FAIL",
      "timeIntervalWindowType": "FIXED",
      "showRateLimitStatisticsInResponseHeader": false,
      "enabled": true
    }
  ]
}

Request Body Fields

The request body is an object containing an array of endpoint rate limit objects.

Endpoint Rate Limit Object

FieldTypeRequiredDefaultDescription
apiProxyNamestringYes-API Proxy name
endpointNamestringYes*-Endpoint path (e.g., “/users”) or “ALL” for all endpoints. Required if endpointHTTPMethod is not “ALL”
endpointHTTPMethodstringYes*-HTTP method. See EnumHttpRequestMethod. Required if endpointName is not “ALL”
permittedMessageCountintegerYes-Maximum number of messages allowed per time interval
timeIntervalPeriodLengthintegerYes-Length of time interval period
timeIntervalstringYes-Time interval unit. See EnumRateLimitTimeInterval
targetVariableobject|nullNonullVariable used to identify clients. See Variable Object
cacheConnectionTimeoutInSecondsintegerYes-Cache connection timeout in seconds
cacheErrorHandlingTypestringYes-Cache error handling type. See EnumCacheErrorHandlingType
timeIntervalWindowTypestringYes-Time interval window type. See EnumIntervalWindowType
targetIdentityValuestring|nullNonullTarget identity value (if not using targetVariable)
showRateLimitStatisticsInResponseHeaderbooleanNofalseShow rate limit statistics in response header
enabledbooleanNotrueEnable rate limiting for this endpoint

EnumHttpRequestMethod (endpointHTTPMethod)

  • GET - GET method
  • POST - POST method
  • PUT - PUT method
  • DELETE - DELETE method
  • PATCH - PATCH method
  • HEAD - HEAD method
  • OPTIONS - OPTIONS method
  • TRACE - TRACE method
  • ALL - All HTTP methods

EnumRateLimitTimeInterval (timeInterval)

  • ONE_SECOND - One second
  • ONE_MINUTE - One minute
  • ONE_HOUR - One hour
  • ONE_DAY - One day
  • ONE_MONTH - One month

EnumCacheErrorHandlingType (cacheErrorHandlingType)

  • FAIL - Fail request when cache error occurs
  • CONTINUE - Continue processing when cache error occurs

EnumIntervalWindowType (timeIntervalWindowType)

  • FIXED - Fixed window (resets at fixed intervals)
  • SLIDING - Sliding window (continuous rolling window)

Variable Object (targetVariable)

See Variable Definition for complete variable documentation.
FieldTypeRequiredDescription
namestringYesVariable name (unique identifier)
descriptionstringNoVariable description
typestringYesVariable type. See Variable Types
headerNamestringNo*Header name (required if type=HEADER)
paramTypestringNo*Parameter type (required if type=PARAMETER). See EnumVariableParameterType
paramNamestringNo*Parameter name (required if type=PARAMETER)
paramPathstringNo*Parameter path template (required if type=PARAMETER and paramType=PATH)
formNamestringNoForm field name (optional, used if paramType=FORM)
messageContentTypestringNo*Message content type (required if type=BODY). See EnumMessageContentType
xpathValuestringNo*XPath expression (required if type=BODY and messageContentType=XML)
jsonPathValuestringNo*JsonPath expression (required if type=BODY and messageContentType=JSON)
contextValuestringNo*Context value (required if type=CONTEXT_VALUES). See EnumVariableContextValue
zoneIdstringNo*Time zone ID (required for date/time context values)
initWithScriptbooleanNofalseWhether to initialize with script (default: false)
scriptLanguagestringNo*Script language (required if type=CUSTOM or initWithScript=true). See EnumScriptType
scriptBodystringNo*Script body (required if type=CUSTOM or initWithScript=true)

Request Body Object

FieldTypeRequiredDescription
endpointRateLimitListarrayYesArray of endpoint rate limit objects

Notes

  • Request body must be an object with endpointRateLimitList array (even for single endpoint)
  • apiProxyName is the API Proxy name
  • endpointName is the endpoint path (e.g., “/users”), not including HTTP method
  • endpointHTTPMethod is the HTTP method (e.g., “GET”, “POST”)
  • If endpointName is “ALL”, endpointHTTPMethod should also be “ALL” or can be omitted
  • If endpointHTTPMethod is “ALL”, endpointName should also be “ALL” or can be omitted
  • endpointId is automatically resolved from endpointName and endpointHTTPMethod (not sent in request)
  • Duplicate endpoints are ignored (not added twice)
  • Endpoints are added to the existing list

Response

Success Response (200 OK)

{
  "success": true
}

Error Response (400 Bad Request)

{
  "error": "bad_request",
  "error_description": "endpointRateLimitList value can not be empty!"
}
or
{
  "error": "bad_request",
  "error_description": "API Proxy with name (MyAPI) is not found in project!"
}
or
{
  "error": "bad_request",
  "error_description": "API Endpoint with name (/users) and method type (GET) is not found in API Proxy!"
}

cURL Example

curl -X POST \
  "https://demo.apinizer.com/apiops/projects/MyProject/rlcl/PremiumUserRLCL/endpoints/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "endpointRateLimitList": [
      {
        "apiProxyName": "MyAPI",
        "endpointName": "/users",
        "endpointHTTPMethod": "GET",
        "permittedMessageCount": 100,
        "timeIntervalPeriodLength": 1,
        "timeInterval": "ONE_MINUTE",
        "cacheConnectionTimeoutInSeconds": 3,
        "cacheErrorHandlingType": "FAIL",
        "timeIntervalWindowType": "FIXED",
        "showRateLimitStatisticsInResponseHeader": false,
        "enabled": true
      }
    ]
  }'

Permissions

  • User must have IDENTITY + MANAGE permission in the project

Notes and Warnings

  • Request Body Format:
    • Request body must be an object with endpointRateLimitList array
    • Even for single endpoint, use object format with array inside
  • API Proxy Name:
    • Use API Proxy name in apiProxyName
    • API Proxy must exist in the project
  • Endpoint Name and Method:
    • endpointName is the endpoint path (e.g., “/users”), not including HTTP method
    • endpointHTTPMethod is the HTTP method (e.g., “GET”, “POST”, “PUT”, “DELETE”)
    • Use “ALL” for both endpointName and endpointHTTPMethod to apply to all endpoints
    • Both endpointName and endpointHTTPMethod are required for specific endpoints
  • Duplicate Handling:
    • Duplicate endpoints are ignored
    • No error is thrown for duplicates
  • RLCL Must Exist:
    • RLCL must exist before adding endpoints