API Gateway Endpoint Policies
API Gateway supports specifying policies on endpoints. For BaaS, this is not enabled in the Admin portal, but instead it can be specified directly on the service.
Only a few policies are supported since most of the API Gateway policies can be applied through code instead.
The following policies are currently supported:
- Quota
- Throttling
- CacheResponse
See the API Gateway documentation for more information on how the policies are configured. Documentation can be found here: https://docs.infor.com/en-us/inforos/. Open the "Infor OS User and Documentation Library". Then go to: Admininistrator -> API Gateway -> Policies.
Examples
Policies are added like this to the "restHandler" in the manifest:
```json
"policies": {
"quota": {
},
"throttling": {
},
"cacheResponse": {
}
}
```
Quota
```json
"quota": {
"userLevel": false,
"interval": 60,
"timeUnit": "second",
"allow": 1000
}
```
Throttling
```json
"throttling": {
"timePeriodInMilliseconds": 60000,
"rateSmoothing.delayAfterCount": 1000,
"rateSmoothing.delayFactorInMilliseconds": 1000,
"spikeArrest.maxRequestsPerPeriod": 1000
}
```
CacheResponse
```json
"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 you expect since it caches all
requests against this service.