Skip to content

Learning and positive model API Since v0.1 ​

Suggestions are never applied without an approve call. For the keys, see Files, positive model, virtual patches and validation policy.

For the base URL, sign-in, roles and error format, see Management API. Except sign-in, a route answers 401 without credentials and 403 when the role is too low.

Routes ​

Positive model ​

MethodPathMinimum roleWhat it doesMain fields
GET/v1/apps/{name}/positiveviewerReturns positive model settings.Returns the current values with base_version.
PUT/v1/apps/{name}/positiveoperatorChanges positive model settings.Body: set (key to value; empty string resets the key), base_version (required), comment, dry_run.
GET/v1/apps/{name}/learningviewerReturns learning status and counts.none
POST/v1/apps/{name}/learning/resetoperatorClears what the model has learned.none
GET/v1/apps/{name}/learning/modelviewerReturns the learned model.none
GET/v1/apps/{name}/learning/model/endpointviewerReturns the learned model of one endpoint.none
GET/v1/apps/{name}/learning/violationsviewerLists requests the model flagged.none
GET/v1/apps/{name}/learning/events/{id}viewerReturns one flagged request with its recorded samples. Viewers see masked samples.none

Suggestions ​

MethodPathMinimum roleWhat it doesMain fields
GET/v1/apps/{name}/learning/suggestionsviewerLists suggested model changes.none
POST/v1/apps/{name}/learning/suggestions/previewviewerShows the effect of suggestions on past traffic.Body: days, enforcement.
POST/v1/apps/{name}/learning/suggestions/approveoperatorAdds approved suggestions to the configuration.Body: ids, all, rules, base_version, comment, dry_run.
POST/v1/apps/{name}/learning/suggestions/rejectoperatorRejects suggestions so they are not offered again.Body: ids.
POST/v1/apps/{name}/learning/suggestions/restoreoperatorRestores rejected suggestions.Body: ids.

Learned schemas ​

MethodPathMinimum roleWhat it doesMain fields
GET/v1/apps/{name}/learning/schema Since v0.2viewerReturns the schemas learned per endpoint.none
GET/v1/apps/{name}/learning/schema/openapi Since v0.2viewerExports the learned schemas as an OpenAPI description.none
GET/v1/apps/{name}/learning/schema/suggestions Since v0.2viewerLists suggested schemas.none
POST/v1/apps/{name}/learning/schema/suggestions/approve Since v0.2operatorAdds approved schemas to the configuration.Body: ids, all, base_version, comment, dry_run.
POST/v1/apps/{name}/learning/schema/suggestions/reject Since v0.2operatorRejects suggested schemas.Body: ids, all.
POST/v1/apps/{name}/learning/schema/suggestions/restore Since v0.2operatorRestores rejected schemas.Body: ids, all.

Example ​

sh
curl -sk -H "Authorization: Bearer waap_EXAMPLE" https://127.0.0.1:9443/v1/apps/shop/learning/suggestions