Apache Con 2020 Presentation: https://www.youtube.com/watch?v=sEKCI8IBCfc
{
"endpoints": [
"your.app.node1:8080",
"your.app.node2:8080"
],
"endpointType": "HTTP",
"connectTimeout": 0,
"socketTimeout": 0,
"name": "api-name",
"secured": true,
"context": "api-context",
"swagger": true,
"swaggerEndpoint": "http://your.server/v2/api-docs",
"blockIfInError": false,
"maxAllowedFailedCalls": 0,
"zipkinTraceIdVisible": false,
"internalExceptionMessageVisible": false,
"internalExceptionVisible": false,
"returnAPIError": false,
"unblockAfter": false,
"unblockAfterMinutes": 0,
"clientID": "your-app-role",
"corsEnabled": true,
"credentialsAllowed": true,
"allowedOrigins": [
"http://your.web.app:4300",
"http://another.web.app:4400"
],
"throttlingPolicy": {
"maxCallsAllowed": 10,
"periodForMaxCalls": 60000,
"applyPerPath": true
}
}
For Docker, please visit: https://github.com/rodrigoserracoelho/capi-docker
Get your first token:
curl --location --request POST 'https://localhost:8443/auth/realms/capi/protocol/openid-connect/token' \
--header 'Authorization: Basic bWFuYWdlcjo5ODg0MDRkMy0zOGJkLTQyNDYtYTkyMy04Yjc3MmMyMTNiODg=' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials'
Publish your first API:
curl --location --request POST 'https://localhost:8080/route' \
--header 'Authorization: Bearer [your first token]' \
--header 'Content-Type: application/json' \
--data-raw '{
"endpoints": [
"your.endpoint.eu:8080"
],
"endpointType": "HTTP",
"connectTimeout": 0,
"socketTimeout": 0,
"name": "first-api",
"secured": true,
"context": "first-api",
"swagger": false,
"swaggerEndpoint": "http://your.endpoint.eu:8080/v2/api-docs",
"blockIfInError": false,
"maxAllowedFailedCalls": 0,
"zipkinTraceIdVisible": false,
"internalExceptionMessageVisible": false,
"internalExceptionVisible": false,
"returnAPIError": false,
"unblockAfter": false,
"unblockAfterMinutes": 0,
"corsEnabled": true,
"credentialsAllowed": true,
"allowedOrigins": [
"http://localhost:4300",
"http://localhost:4400",
"http://localhost:4200"
],
"throttlingPolicy": {
"maxCallsAllowed": 10,
"periodForMaxCalls": 60000,
"applyPerPath": true
}
}'
Shortly your API will be available here:
curl --location --request GET 'https://localhost:8380/gateway/first-api/some/context'