The functionality allows you to use API calls to manage the settings of the API Firewall (create, delete, modify, view specifications, etc.).
Settings are managed using specially designed queries. The general conventions (authorization, response codes, the *_hash methods and paginated selection) are described in the relevant section.
Request example:
curl http://api.example.com:8080/openapi/v1/get_url --header 'Content-type: application/json' --data '{"key": "%PRODUCT KEY%"}'
Response format:
The parameterized sections of the path are replaced with {str} in the response.
{
"status": "success",
"url": [string, ...]
}
or (in the case where data is missing)
{"status": "none"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Response example:
{"status": "success", "url": ["example.com/api/v1/user/{str}"]}
Request example:
curl http://api.example.com:8080/openapi/v1/get_schemas --header 'Content-type: application/json' --data '{"key": "%PRODUCT KEY%"}'
Response format:
{
"status": "success",
"schemas": [
{
"host": string,
"schema": string
},
...
]
}
or (in the case where data is missing)
{"status": "none"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Response example:
{
"status": "success",
"schemas": [
{
"host": "example.com",
"schema": "b3BlbmFwaSBzY2hlbWEgaW4gYmFzZTY0"
},
...
]
}
The method allows you to check whether the data has changed without downloading it in full. More detailed information is available in the relevant section.
Request example:
curl http://api.example.com:8080/openapi/v1/get_schemas_hash --header 'Content-type: application/json' --data '{"key": "%PRODUCT KEY%"}'
Response example:
{"status": "success", "hash": "8ddd2b342d3190a866ee35afb249919a"}
Request example:
curl http://api.example.com:8080/openapi/v1/set_schema --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"set": {
"host": "example.com",
"schema": "b3BlbmFwaSBzY2hlbWEgaW4gYmFzZTY0"
}
}'
Strict matching and wildcard values are allowed: example.com, .example.com, *.example.com, *.
The specification is converted to OpenAPI 3.1 and then checked for compliance. It is stored in that form. The simultaneous use of readOnly: true and writeOnly: true for the same element is not allowed.
To work correctly, the domain name specified in the specification must be used as the name of the specification.
For example, if the specification specifies the servers parameter with the value:
"servers": [
{
"url": "http://example.com"
}
]
the name of the specification should be example.com.
After creating or modifying the specification, you must specify a list of URLs for the Filter, which will be analyzed for compliance with the request specification. If the list of URLs is not specified or does not comply with the specification, the request will not be analyzed.
Response example:
{"status": "success"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Request example:
curl http://api.example.com:8080/openapi/v1/set_url --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"url": [
"example.com/admin",
"*/api/v1/user",
".example.com/admin/info",
"*.example.com/v1/client/info"
]
}'
Required parameters:
url - the list of addresses in the format host[/path]. The host is converted to punycode.The list is transmitted in its entirety and completely replaces the previously saved one. An empty list (null) deletes the saved data:
curl http://api.example.com:8080/openapi/v1/set_url --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"url": null
}'
Response example:
{"status": "success"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
The method allows you to check whether the data has changed without downloading it in full. More detailed information is available in the relevant section.
Request example:
curl http://api.example.com:8080/openapi/v1/get_url_hash --header 'Content-type: application/json' --data '{"key": "%PRODUCT KEY%"}'
Response example:
{"status": "success", "hash": "8ddd2b342d3190a866ee35afb249919a"}
Request example:
curl http://api.example.com:8080/openapi/v1/set_schema --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"set": {
"host": "example.com",
"old_host": "example.us",
"schema": "b3BlbmFwaSBzY2hlbWEgaW4gYmFzZTY0"
}
}'
Parameters:
host - the new name of the specification (required);old_host - the current name of the specification (required when renaming);schema - the specification in the Base64 format. The parameter is required if old_host is not set.When renaming, the related data is updated automatically: the list of API addresses, the path schemas and the excluded addresses.
Strict matching and wildcard values are allowed: example.com, .example.com, *.example.com, *.
To work correctly, the domain name specified in the specification must be used as the name of the specification.
For example, if the specification specifies the
serversparameter with the value:"servers": [ { "url": "http://example.com" } ]the name of the specification should be
example.com.
Response example:
{"status": "success"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Request example:
curl http://api.example.com:8080/openapi/v1/set_schema --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"del": {
"host": "example.com"
}
}'
Response example:
{"status": "success"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Request example:
curl http://api.example.com:8080/openapi/v1/get_schema_paths --header 'Content-type: application/json' --data '{"key": "%PRODUCT KEY%"}'
MLC analyzes requests and, based on the corresponding list of hosts, automatically generates specifications for each request path.
Response format:
{
"paths": [
{
"host": string,
"path": string,
"schema": string
},
...
]
}
or
{"status": "none"}
Response example:
{
"paths": [
{
"host": "example.com",
"path": "/index/",
"schema": "b3BlbmFwaSBzY2hlbWEgaW4gYmFzZTY0"
},
...
]
}
An example of a response with the decoded content of the specification:
{
"paths": [
{
"host": "example.com",
"path": "/url_1/",
"schema": {
"example.com": {
"/url_1/": {
"post": {
"requestBody": {
"content": {
"*/*": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"order": {
"type": "string"
}
},
"required": [
"id",
"order"
]
}
}
}
}
}
}
}
}
},
...
]
}
The method allows you to check whether the data has changed without downloading it in full. More detailed information is available in the relevant section.
Request example:
curl http://api.example.com:8080/openapi/v1/get_schema_paths_hash --header 'Content-type: application/json' --data '{"key": "%PRODUCT KEY%"}'
Response example:
{"status": "success", "hash": "8ddd2b342d3190a866ee35afb249919a"}
Request example:
curl http://api.example.com:8080/openapi/v1/set_schema_paths --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"set": {
"host": "example.com",
"path": "/abcd/",
"schema": "b3BlbmFwaSBzY2hlbWEgaW4gYmFzZTY0"
}
}'
Required parameters:
host - the name of the specification;path - the request path;schema - the specification in the Base64 format.The path schema is converted to OpenAPI 3.1 before it is stored.
Response example:
{"status": "success"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Request example:
curl http://api.example.com:8080/openapi/v1/set_schema_paths --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"del": {
"host": "example.com",
"path": "/abcd/"
}
}'
Response example:
{"status": "success"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Request example:
curl http://api.example.com:8080/openapi/v1/set_exclude_paths --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"set": {
"exclude_paths": [
{
"host": "example.com",
"path": "/abc/"
}
]
}
}'
Response example:
{"status": "success"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
Request example:
curl http://api.example.com:8080/openapi/v1/get_exclude_paths --header 'Content-type: application/json' --data '{"key": "%PRODUCT KEY%"}'
Response format:
{
"exclude_paths": [object, ...]
}
Response example:
{
"exclude_paths": [
{
"host": "example.com",
"path": "/abcd/"
}
]
}
Request example:
curl http://api.example.com:8080/openapi/v1/set_exclude_paths --header 'Content-type: application/json' --data '{
"key": "%PRODUCT KEY%",
"set": {
"exclude_paths": null
}
}'
Response example:
{"status": "success"}
or (in case of an error)
{"status": "fail", "description": "%DESCRIPTION%"}
The method allows you to check whether the data has changed without downloading it in full. More detailed information is available in the relevant section.
Request example:
curl http://api.example.com:8080/openapi/v1/get_exclude_paths_hash --header 'Content-type: application/json' --data '{"key": "%PRODUCT KEY%"}'
Response example:
{"status": "success", "hash": "8ddd2b342d3190a866ee35afb249919a"}