HTTP API Gateway
Bondy API Gateway is a reverse proxy that lets you manage, configure, and route requests to your WAMP APIs and also to external HTTP/REST APIs. It allows Bondy to be integrated into an existing HTTP/REST API ecosystem.
Procedures
The following wamp api is used to configure and manage the API Gateway Specification:
Name | URI |
---|---|
Add an API Spec | bondy.http_gateway.api.add |
Get an API Spec | bondy.http_gateway.api.get |
List all API Specs | bondy.http_gateway.api.list |
Load an API Spec | bondy.http_gateway.api.load |
Delete an API Spec | bondy.http_gateway.api.delete |
API Add
WARNING
CURRENTLY NOT IMPLEMENTED
API Delete
WARNING
CURRENTLY NOT IMPLEMENTED
API Get
bondy.http_gateway.api.get(api_spec_id) -> result(api_spec)
It allows to retrieve the requested api spec id.
This procedure is useful for example to be entirely sure to check if the api spec definition was properly loaded and activated.
Call
Positional Args
0
stringREQUIREDThe id of the api spec you want to retrieve.
Keyword Args
None.
Result
Positional Results
0
objectThe api spec data
Keyword Results
None.
Errors
- bondy.error.not_found: when the provided api spec id is not found.
- wamp.error.invalid_argument: when there is an invalid number of positional arguments.
Examples
Success Call
:: code-group
./wick --url ws://localhost:18080/ws \
--realm com.leapsight.bondy \
call bondy.http_gateway.api.get \
'com.market.demo' | jq
[
{
"defaults": {
"connect_timeout": 5000,
"headers": "{{variables.cors_headers}}",
"retries": 0,
"schemes": "{{variables.schemes}}",
"security": "{{variables.oauth2}}",
"timeout": 15000
},
"host": "_",
"id": "com.market.demo",
"meta": {},
"name": "Marketplace Demo API",
"realm_uri": "com.market.demo",
"status_codes": {
"com.example.error.internal_error": 500,
"com.example.error.not_found": 404,
"com.example.error.unknown_error": 500
},
"ts": -576459578303,
"variables": {},
"versions": {}
}
]
:::
API List
bondy.http_gateway.api.list() -> result([api_spec])
It allows to retrieve the all loaded apis spec.
Call
Positional Args
None
Keyword Args
None.
Result
Positional Results
0
array[object]The list of all loaded api specs.
Keyword Results
None.
Errors
Examples
Success Call
./wick --url ws://localhost:18080/ws \
--realm com.leapsight.bondy \
call bondy.http_gateway.api.load \
API Load
bondy.http_gateway.api.load(api_spec_data)
Validates, loads and activates the api spec definition.
Call
Positional Args
0
objectThe api spec data
Keyword Args
None.
Result
Positional Results
None.
Keyword Results
None.
Errors
- bondy.error.invalid_data: when the data values are invalid.
- wamp.error.invalid_argument: when there is an invalid number of positional arguments.
Examples
Below there is an example loading the partial spec of the Marketplace api spec you can find at api_gateway_config.json
Success Call
./wick --url ws://localhost:18080/ws \
--realm com.leapsight.bondy \
call bondy.http_gateway.api.load \
'{
"id":"com.market.demo",
"name":"Marketplace Demo API",
"host":"_",
"realm_uri":"com.market.demo",
"meta":{
},
"variables":{
},
"defaults":{
"retries":0,
"timeout":15000,
"connect_timeout":5000,
"schemes":"{{variables.schemes}}",
"security":"{{variables.oauth2}}",
"headers":"{{variables.cors_headers}}"
},
"status_codes": {
"com.example.error.not_found": 404,
"com.example.error.unknown_error": 500,
"com.example.error.internal_error": 500
},
"versions": {
}
}' | jq
None if it was loaded successfully