API Gateway endpoint policies

API Gateway supports policies on endpoints. For BaaS, policies are not enabled in the Admin portal. Instead, policies are specified directly on the service.

Only a few policies are supported because most API Gateway policies can be applied through code.

The currently supported policies are:

  • Quota
  • Throttling
  • CacheResponse
  • TargetTimeout

See the API Gateway documentation for information about how policies are configured. Open the Infor OS User and Documentation Library, then navigate to Administrator > API Gateway > Policies.

See Infor OS documentation.

Policies are added to the restHandler in the manifest:

"policies": {
      "quota": {
      },
      "throttling": {
      },
      "cacheResponse": {
      },
      "targetTimeout": {
      }
      }

Quota

"quota": {
        "userLevel": false,
        "interval": 60,
        "timeUnit": "second",
        "allow": 1000
        }

Throttling

"throttling": {
        "timePeriodInMilliseconds": 60000,
        "rateSmoothing.delayAfterCount": 500,
        "rateSmoothing.delayFactorInMilliseconds": 1000,
        "spikeArrest.maxRequestsPerPeriod": 1000
        }

CacheResponse

"cacheResponse": {
        "userLevel": false,
        "cacheKey.prefix": "myPrefix",
        "cacheKey.keyFragment": "myFragment",
        "cacheKey.keyFragment.ref": [
        "request.queryparam.EXAMPLE1",
        "request.queryparam.EXAMPLE2"
        ],
        "expireSettings.timeoutInSeconds": 3600
        }
Note: Verify that this policy works as expected because it caches all requests against this service.

TargetTimeout

"targetTimeout": {
        "timeout": 300
        }
Note: This policy is evaluated together with the REST handler timeout. The policy timeout must be 5 seconds greater than the timeout in the REST handler. Set the REST handler timeout using the Deployment Configuration rest.handler.timeout.