API v1¶
Swagger¶
http://127.0.0.1:5000/api/v1/swagger.json
Swagger UI: http://127.0.0.1:5000/api/v1
{
"swagger": "2.0",
"basePath": "/api/v2/stats",
"paths": {
"/": {
"post": {
"responses": {
"201": {
"description": "Success",
"schema": {
"$ref": "#/definitions/Stats"
}
}
},
"summary": "Create a new stats",
"operationId": "create_stats",
"parameters": [
{
"name": "payload",
"required": true,
"in": "body",
"schema": {
"$ref": "#/definitions/Stats"
}
},
{
"name": "X-Fields",
"in": "header",
"type": "string",
"format": "mask",
"description": "An optional fields mask"
}
],
"tags": [
"default"
]
},
"get": {
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/StatsList"
}
}
}
},
"summary": "List all stats",
"operationId": "list_stats",
"parameters": [
{
"name": "organization",
"in": "query",
"type": "string",
"description": "Organization of the stats"
},
{
"name": "anr",
"in": "query",
"type": "string",
"description": "UUID of the Anr of the stats"
},
{
"name": "type",
"in": "query",
"type": "string",
"description": "Type of the stats (risk, vulnerability, threat)"
},
{
"name": "day",
"in": "query",
"type": "integer",
"description": "Day of the stats"
},
{
"name": "week",
"in": "query",
"type": "integer",
"description": "Week of the stats"
},
{
"name": "month",
"in": "query",
"type": "integer",
"description": "Month of the stats"
},
{
"name": "year",
"in": "query",
"type": "integer",
"description": "Year of the stats"
},
{
"name": "page",
"in": "query",
"type": "integer",
"default": 1
},
{
"name": "per_page",
"in": "query",
"type": "integer"
},
{
"name": "X-Fields",
"in": "header",
"type": "string",
"format": "mask",
"description": "An optional fields mask"
}
],
"tags": [
"default"
]
}
},
"/{uuid}": {
"parameters": [
{
"in": "path",
"description": "The stats identifier",
"name": "uuid",
"required": true,
"type": "string"
}
],
"delete": {
"responses": {
"404": {
"description": "Stats not found"
},
"204": {
"description": "Stats deleted"
}
},
"summary": "Delete a stats given its identifier",
"operationId": "delete_stats",
"tags": [
"default"
]
},
"get": {
"responses": {
"404": {
"description": "Stats not found"
},
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/Stats"
}
}
},
"summary": "Fetch a given resource",
"operationId": "get_stats",
"parameters": [
{
"name": "X-Fields",
"in": "header",
"type": "string",
"format": "mask",
"description": "An optional fields mask"
}
],
"tags": [
"default"
]
},
"put": {
"responses": {
"404": {
"description": "Stats not found"
},
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/Stats"
}
}
},
"summary": "Update a stats given its identifier",
"operationId": "put_stats_item",
"parameters": [
{
"name": "payload",
"required": true,
"in": "body",
"schema": {
"$ref": "#/definitions/Stats"
}
},
{
"name": "X-Fields",
"in": "header",
"type": "string",
"format": "mask",
"description": "An optional fields mask"
}
],
"tags": [
"default"
]
}
}
},
"info": {
"title": "MONARC Stats service - API v2",
"version": "2.0",
"description": "API v2 of the MONARC Stats service."
},
"produces": [
"application/json"
],
"consumes": [
"application/json"
],
"tags": [
{
"name": "default",
"description": "Default namespace"
}
],
"definitions": {
"Stats": {
"properties": {
"uuid": {
"type": "string",
"description": "The stats unique identifier",
"readOnly": true
},
"organization": {
"type": "string",
"description": "The organization related to this stats.",
"readOnly": true
},
"anr": {
"type": "string",
"description": "The ANR related to this stats."
},
"type": {
"type": "string",
"description": "The type of this stats (risk, vulnerability, threat)."
},
"day": {
"type": "integer",
"description": "Day of the stats."
},
"week": {
"type": "integer",
"description": "Week of the stats."
},
"month": {
"type": "integer",
"description": "Month of the stats."
},
"year": {
"type": "integer",
"description": "Year of the stats."
},
"data": {
"type": "object",
"description": "The stats as a dynamic JSON object."
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Created time of the stats."
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Updated time of the stats."
}
},
"type": "object"
},
"StatsList": {
"properties": {
"metadata": {
"type": "object",
"description": "Metada related to the result (number of page, current page, total number of objects.)."
},
"data": {
"type": "array",
"description": "List of stats objects",
"items": {
"$ref": "#/definitions/Stats"
}
}
},
"type": "object"
}
},
"responses": {
"ParseError": {
"description": "When a mask can't be parsed"
},
"MaskError": {
"description": "When any error occurs on mask"
}
}
}