{
  "openapi": "3.0.3",
  "info": {
    "title": "Command Invocation REST",
    "version": "v1",
    "description": ""
  },
  "servers": [
    {
      "url": "https://cloud.kaaiot.com/cex/api/v1",
      "description": "API Server"
    }
  ],
  "paths": {
    "/endpoints/{endpointId}/commands/{commandType}": {
      "parameters": [
        {
          "name": "endpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Unique endpoint identifier."
        },
        {
          "name": "commandType",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Represents the command type that a client wants to invoke on an endpoint.\nCommand type MUST be a non-empty alpha-numeric string identifying the command type to the endpoint."
        }
      ],
      "post": {
        "description": "Invokes command on an endpoint.\nReturns command execution result if the command was executed within the specified 'awaitTimeout'.\nOtherwise, returns the command result resource URL in the 'Location' header.",
        "responses": {
          "200": {
            "description": "Command was successfully invoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandInvocationSyncResponse"
                },
                "example": {
                  "message": "Client custom response"
                }
              }
            }
          },
          "202": {
            "description": "Command was accepted for the execution. Returns 'Location' header for fetching the command execution result.\n",
            "headers": {
              "Location": {
                "description": "Location of the newly created command for retrieving a result.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid 'awaitTimeout' or 'commandTtl' parameter value."
          },
          "404": {
            "description": "Endpoint is not found or the querying user is denied access."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ],
        "parameters": [
          {
            "name": "awaitTimeout",
            "in": "query",
            "description": "The maximum duration (in seconds) a web client is willing to wait for a command execution response from a device.\nMust not be greater than specified `spring.mvc.async.request-timeout` value (60 seconds by default).\nSee Spring documentation for the details.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 5
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommandInvocationRequest"
              },
              "example": {
                "longitude": 1.23463453,
                "latitude": 0.92312412
              }
            }
          }
        }
      }
    },
    "/endpoints/{endpointId}/commands/{commandType}/{commandId}": {
      "parameters": [
        {
          "name": "endpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Unique endpoint identifier."
        },
        {
          "name": "commandType",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Represents the command type that a client wants to invoke on an endpoint.\nCommand type MUST be a non-empty alpha-numeric string identifying the command type to the endpoint."
        },
        {
          "name": "commandId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Unique command identifier."
        }
      ],
      "get": {
        "description": "Returns command information.",
        "responses": {
          "200": {
            "description": "Information is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandDescriptor"
                },
                "example": {
                  "commandId": 123,
                  "commandType": "RESET",
                  "endpointId": "59126304-4970-4f80-91a1-06e9ae2b7705",
                  "status": "EXECUTED",
                  "statusCode": 200,
                  "reasonPhrase": "Successfully executed",
                  "requestPayload": {
                    "anyFields": "anyValues"
                  },
                  "responsePayload": {
                    "anyFields": "anyValues"
                  },
                  "createdAt": "2017-04-20T15:01:12.144Z",
                  "updatedAt": "2017-04-20T15:01:25.286Z"
                }
              }
            }
          },
          "404": {
            "description": "Endpoint or resource with specified commandId is not found or the querying user is denied access."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ]
      },
      "delete": {
        "description": "Deletes command.",
        "responses": {
          "204": {
            "description": "Command is successfully deleted."
          },
          "404": {
            "description": "Endpoint or resource with specified commandId is not found or the querying user is denied access."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ]
      }
    },
    "/endpoints/{endpointId}/commands/{commandType}/last": {
      "parameters": [
        {
          "name": "endpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Unique endpoint identifier."
        },
        {
          "name": "commandType",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Represents the command type that a client wants to invoke on an endpoint.\nCommand type MUST be a non-empty alpha-numeric string identifying the command type to the endpoint."
        }
      ],
      "get": {
        "description": "Returns last `executed` command by endpoint.",
        "responses": {
          "200": {
            "description": "The last command that was sent to the endpoint and has the `executed` status is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "commandId": 123,
                  "commandType": "RESET",
                  "endpointId": "59126304-4970-4f80-91a1-06e9ae2b7705",
                  "status": "EXECUTED",
                  "statusCode": 200,
                  "reasonPhrase": "Successfully executed",
                  "requestPayload": {
                    "anyFields": "anyValues"
                  },
                  "responsePayload": {
                    "anyFields": "anyValues"
                  },
                  "createdAt": "2017-04-20T15:01:12.144Z",
                  "updatedAt": "2017-04-20T15:01:25.286Z"
                }
              }
            }
          },
          "404": {
            "description": "Last command that has the 'executed' status not found."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ]
      }
    },
    "/endpoints/commands": {
      "get": {
        "description": "Returns a list of all commands for given endpoints grouped by endpoint.",
        "responses": {
          "200": {
            "description": "List of endpoints commands grouped by endpoint is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListOfEndpointsCommandDescriptors"
                },
                "example": [
                  {
                    "endpointId": "59126304-4970-4f80-91a1-06e9ae2b7705",
                    "commands": [
                      {
                        "commandId": 123,
                        "commandType": "RESET",
                        "endpointId": "59126304-4970-4f80-91a1-06e9ae2b7705",
                        "status": "EXECUTED",
                        "statusCode": 200,
                        "reasonPhrase": "Done successfully",
                        "requestPayload": {
                          "anyFields": "anyValues"
                        },
                        "responsePayload": {
                          "anyFields": "anyValues"
                        },
                        "createdAt": "2017-04-20T15:01:12.144Z",
                        "updatedAt": "2017-04-20T15:01:25.286Z"
                      },
                      {
                        "commandId": 321,
                        "commandType": "RESET",
                        "endpointId": "aa773080-0fda-49c0-aacf-500baab0170b",
                        "status": "PENDING",
                        "requestPayload": {
                          "anyFields": "anyValues"
                        },
                        "createdAt": "2017-04-20T15:01:12.244Z",
                        "updatedAt": "2017-04-20T15:01:28.286Z"
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "endpointId",
            "in": "query",
            "description": "Comma-separated list of endpoint IDs",
            "required": false,
            "schema": {
              "type": "string[]"
            },
            "example": "2ebaf0ab-76f3-4211-a27f-af310be8987f,8b4aec8a-0a13-4b92-ba0b-0a39cfd5e297"
          },
          {
            "name": "commandTypes",
            "in": "query",
            "description": "Comma-separated list of command types",
            "required": false,
            "schema": {
              "type": "string[]"
            },
            "example": "TEST,RESTART,STOP"
          }
        ]
      }
    },
    "/endpoints/commands/{applicationName}": {
      "parameters": [
        {
          "name": "applicationName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application name",
          "example": "smart-kettle"
        }
      ],
      "get": {
        "description": "Returns a pageable list of all commands for given endpoints in specific application.",
        "responses": {
          "200": {
            "description": "Pageable list of endpoints commands is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagableCommandDescriptors"
                },
                "example": {
                  "content": [
                    {
                      "createdAt": "2017-04-20T15:01:12.144Z",
                      "updatedAt": "2017-04-20T15:01:25.286Z",
                      "commandId": 284,
                      "commandType": "get-co2",
                      "endpointId": "e11acaa6-d35e-463b-be92-b9b4a1245c44",
                      "status": "PENDING",
                      "statusCode": null,
                      "reasonPhrase": null,
                      "requestPayload": {
                        "command": "MAX:1h"
                      },
                      "responsePayload": null
                    },
                    {
                      "createdAt": "2017-04-20T15:01:12.144Z",
                      "updatedAt": "2017-04-20T15:01:25.286Z",
                      "commandId": 284,
                      "commandType": "get-co2",
                      "endpointId": "23e1f247-b7db-4d96-8f96-545ed7c20574",
                      "status": "PENDING",
                      "statusCode": null,
                      "reasonPhrase": null,
                      "requestPayload": {
                        "command": "MAX:1h"
                      },
                      "responsePayload": null
                    },
                    {
                      "createdAt": "2017-04-20T15:01:12.144Z",
                      "updatedAt": "2017-04-20T15:01:25.286Z",
                      "commandId": 284,
                      "commandType": "get-co2",
                      "endpointId": "8a93e4cf-fc7b-4160-a8b2-627b0d2ce9f4",
                      "status": "PENDING",
                      "statusCode": null,
                      "reasonPhrase": null,
                      "requestPayload": {
                        "command": "MAX:1h"
                      },
                      "responsePayload": null
                    }
                  ],
                  "pageable": {
                    "sort": {
                      "sorted": false,
                      "unsorted": true,
                      "empty": true
                    },
                    "pageNumber": 0,
                    "pageSize": 20,
                    "offset": 0,
                    "paged": true,
                    "unpaged": false
                  },
                  "totalElements": 3,
                  "totalPages": 1,
                  "last": true,
                  "sort": {
                    "sorted": false,
                    "unsorted": true,
                    "empty": true
                  },
                  "numberOfElements": 3,
                  "first": true,
                  "size": 20,
                  "number": 0,
                  "empty": false
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:endpoint-command:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "Page number started from zero.",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Field to sort by. Sort direction goes after comma `,`, e.g., `updatedAt,asc`",
            "required": false,
            "schema": {
              "type": "string",
              "default": "createdAt,desc",
              "enum": [
                "createdAt",
                "updatedAt",
                "descriptor.commandType",
                "descriptor.endpointId"
              ]
            },
            "example": "createdAt,desc"
          },
          {
            "name": "size",
            "in": "query",
            "description": "",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "commandTypes",
            "in": "query",
            "description": "Comma-separated list of command types",
            "required": false,
            "schema": {
              "type": "string[]"
            },
            "example": "TEST,RESTART,STOP"
          }
        ]
      }
    },
    "/endpoints/commands/last": {
      "post": {
        "description": "Returns the last executed command for each command type for each of the specified endpoints.\nThis allows fetching command status for multiple endpoints and command types in a single request.",
        "responses": {
          "200": {
            "description": "List of last commands for each endpoint is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListOfEndpointLastCommands"
                },
                "example": [
                  {
                    "endpointId": "2ebaf0ab-76f3-4211-a27f-af310be8987f",
                    "commands": [
                      {
                        "commandId": 123,
                        "commandType": "REBOOT",
                        "endpointId": "2ebaf0ab-76f3-4211-a27f-af310be8987f",
                        "status": "EXECUTED",
                        "statusCode": 200,
                        "reasonPhrase": "Successfully executed",
                        "requestPayload": {
                          "anyFields": "anyValues"
                        },
                        "responsePayload": {
                          "anyFields": "anyValues"
                        },
                        "createdAt": "2025-12-17T10:00:00.000Z",
                        "updatedAt": "2025-12-17T10:01:25.000Z"
                      },
                      {
                        "commandId": 456,
                        "commandType": "UPDATE_FIRMWARE",
                        "endpointId": "2ebaf0ab-76f3-4211-a27f-af310be8987f",
                        "status": "EXECUTED",
                        "statusCode": 200,
                        "reasonPhrase": "Successfully executed",
                        "requestPayload": {
                          "version": "1.2.3"
                        },
                        "responsePayload": {
                          "status": "updated"
                        },
                        "createdAt": "2025-12-17T09:00:00.000Z",
                        "updatedAt": "2025-12-17T09:05:00.000Z"
                      }
                    ]
                  },
                  {
                    "endpointId": "8b4aec8a-0a13-4b92-ba0b-0a39cfd5e297",
                    "commands": []
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LastCommandsRequest"
              },
              "example": {
                "endpointIds": [
                  "2ebaf0ab-76f3-4211-a27f-af310be8987f",
                  "8b4aec8a-0a13-4b92-ba0b-0a39cfd5e297"
                ],
                "commandTypes": [
                  "REBOOT",
                  "UPDATE_FIRMWARE"
                ]
              }
            }
          }
        }
      }
    },
    "/endpoints/commands/{commandType}/batch/by-filter": {
      "parameters": [
        {
          "name": "commandType",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Represents the command type that a client wants to invoke on endpoints.\nCommand type MUST be a non-empty alpha-numeric string identifying the command type to the endpoints."
        }
      ],
      "post": {
        "description": "Invokes command on the endpoints that match the specified filter ID.\nReturns the batch command execution task ID.",
        "responses": {
          "202": {
            "description": "Batch command execution task is accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchCommandExecutionAcceptedResponse"
                },
                "example": {
                  "taskId": 6591300
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ],
        "parameters": [
          {
            "name": "filterId",
            "in": "query",
            "description": "Unique filter identifier that endpoints must match.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "longitude": 1.23463453,
                "latitude": 0.92312412
              }
            }
          }
        }
      }
    },
    "/endpoints/commands/{commandType}/batch/by-endpoints": {
      "parameters": [
        {
          "name": "commandType",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Represents the command type that a client wants to invoke on endpoints.\nCommand type MUST be a non-empty alpha-numeric string identifying the command type to the endpoints."
        }
      ],
      "post": {
        "description": "Invokes command on specified endpoints. Returns the batch command execution task ID.",
        "responses": {
          "202": {
            "description": "Batch command execution task is accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "taskId": 6591300
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommandInvocationEndpointsRequest"
              },
              "example": {
                "payload": "{\"state\": \"ON\"}",
                "payloadContentType": "application/json",
                "endpointIds": [
                  "56726466-e454-23ac-340c-f34fefda7d01"
                ]
              }
            }
          }
        }
      }
    },
    "/endpoints/commands/batch/tasks": {
      "get": {
        "description": "Returns the history of batch command execution tasks.",
        "responses": {
          "200": {
            "description": "The history of batch command execution tasks is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchCommandExecutionTaskStatusPageInfo"
                },
                "example": {
                  "totalElements": 10,
                  "content": [
                    {
                      "taskId": 15,
                      "filterId": "330f1291-7791-46a0-bb6f-9128e0038d3b",
                      "commandType": "power-switch",
                      "requestPayload": {
                        "state": "ON"
                      },
                      "createdAt": "2021-04-20T15:01:12.144Z",
                      "pendingCount": 5,
                      "executedCount": 8,
                      "expiredCount": 1
                    },
                    {
                      "taskId": 16,
                      "filterId": "330f1291-7791-46a0-bb6f-9128e0038d3b",
                      "commandType": "power-switch",
                      "requestPayload": {
                        "state": "OFF"
                      },
                      "createdAt": "2021-04-20T16:05:28.256Z",
                      "pendingCount": 3,
                      "executedCount": 10,
                      "expiredCount": 1
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "appName",
            "in": "query",
            "description": "Application name.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "smart-kettle"
          },
          {
            "name": "commandType",
            "in": "query",
            "description": "Represents the command type that was invoked on the endpoints. Used as a filter.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "powerOn"
          },
          {
            "name": "filterId",
            "in": "query",
            "description": "Unique filter identifier that was used for batch command execution. Used as a filter.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "452a38b5-452d-41a8-9651-bf304092faa3"
          },
          {
            "name": "sortBy",
            "in": "query",
            "description": "Represents the parameter that will be used for sorting results. Used together with sortOrder.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "commandType",
                "createdAt",
                "taskId"
              ]
            },
            "example": "commandType"
          },
          {
            "name": "sortOrder",
            "in": "query",
            "description": "Represents the sorting order parameter. Used together with sortBy.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "ASC",
              "enum": [
                "ASC",
                "DESC"
              ]
            },
            "example": "DESC"
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Start index that the server should return data from.",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "example": 0
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of items to return. To get all items limit must be 0.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            },
            "example": 100
          }
        ]
      }
    },
    "/endpoints/commands/batch/tasks/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "description": "Batch command execution task ID.",
          "example": 6591300
        }
      ],
      "get": {
        "description": "Returns batch command execution task status.",
        "responses": {
          "200": {
            "description": "Batch command execution task's status is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchCommandExecutionStatusResponse"
                },
                "example": {
                  "pending": [
                    {
                      "endpointId": "56726466-e454-23ac-340c-f34fefda7d01",
                      "commandId": 1
                    }
                  ],
                  "executed": [
                    {
                      "endpointId": "56726466-e454-23ac-340c-f34fefda7d03",
                      "commandId": 2
                    }
                  ],
                  "expired": [
                    {
                      "endpointId": "56726466-e454-23ac-340c-f34fefda7d02",
                      "commandId": 3
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:endpoint-command:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "appName",
            "in": "query",
            "description": "Application name.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "smart-kettle"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth_2_0": {
        "type": "oauth2",
        "description": "CEX supports OAuth 2.0 for authenticating all API requests.\n",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://auth.example.com/oauth/authorize",
            "scopes": {}
          }
        }
      }
    },
    "schemas": {
      "CommandInvocationRequest": {},
      "CommandInvocationSyncResponse": {},
      "CommandDescriptor": {
        "type": "object",
        "properties": {
          "commandId": {
            "type": "integer",
            "description": "Command unique identifier."
          },
          "commandType": {
            "type": "string",
            "description": "Command type."
          },
          "endpointId": {
            "type": "string",
            "description": "Endpoint unique identifier."
          },
          "status": {
            "type": "string",
            "description": "Status of command execution"
          },
          "statusCode": {
            "type": "integer",
            "description": "Http status code."
          },
          "reasonPhrase": {
            "type": "string",
            "description": "Status code description."
          },
          "requestPayload": {
            "description": "Request payload to endpoint."
          },
          "responsePayload": {
            "description": "Endpoint payload response."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the command was created."
          },
          "updatedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the command status was last updated."
          }
        },
        "required": [
          "commandId",
          "commandType",
          "endpointId",
          "status",
          "createdAt",
          "updatedAt"
        ]
      },
      "ListOfEndpointsCommandDescriptors": {},
      "CommandDescriptorsForEndpoint": {
        "type": "object",
        "properties": {
          "endpointId": {
            "type": "string",
            "description": "Unique endpoint identifier."
          },
          "commands": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "List of commands"
          }
        }
      },
      "PagableCommandDescriptors": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommandDescriptorsForEndpoint"
            }
          },
          "pageable": {
            "type": "object"
          },
          "totalElements": {
            "type": "integer"
          },
          "totalPages": {
            "type": "integer"
          },
          "last": {
            "type": "boolean"
          },
          "sort": {
            "type": "object"
          },
          "numberOfElements": {
            "type": "integer"
          },
          "first": {
            "type": "boolean"
          },
          "size": {
            "type": "integer"
          },
          "number": {
            "type": "integer"
          },
          "empty": {
            "type": "boolean"
          }
        }
      },
      "LastCommandsRequest": {
        "type": "object",
        "properties": {
          "endpointIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of endpoint IDs to fetch last commands for."
          },
          "commandTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of command types to fetch last commands for."
          }
        },
        "required": [
          "endpointIds",
          "commandTypes"
        ]
      },
      "ListOfEndpointLastCommands": {},
      "BatchCommandExecutionAcceptedResponse": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "integer",
            "description": "Batch command execution task ID."
          }
        },
        "required": [
          "taskId"
        ]
      },
      "CommandInvocationEndpointsRequest": {
        "type": "object",
        "properties": {
          "payload": {
            "type": "string",
            "description": "Command payload"
          },
          "payloadContentType": {
            "type": "string",
            "description": "Command payload content type.\nIn case \"application/json\" is specified, the payload is validated to be a valid JSON.\nIn case \"text/plain\" is specified, no specific validation logic is applied.\n"
          },
          "endpointIds": {
            "type": "string",
            "description": "Endpoint IDs"
          }
        },
        "required": [
          "payload",
          "payloadContentType",
          "endpointIds"
        ]
      },
      "BatchCommandExecutionTaskStatus": {
        "type": "object",
        "properties": {
          "taskId": {
            "type": "integer",
            "description": "Task ID."
          },
          "filterId": {
            "type": "string",
            "description": "Filter ID."
          },
          "commandType": {
            "type": "string",
            "description": "Command type."
          },
          "requestPayload": {
            "description": "Request payload for commands."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the task was created."
          },
          "pendingCount": {
            "type": "integer",
            "description": "Count of commands that has 'pending' state."
          },
          "executedCount": {
            "type": "integer",
            "description": "Count of commands that has 'executed' state."
          },
          "expiredCount": {
            "type": "integer",
            "description": "Count of commands that were expired."
          }
        },
        "required": [
          "taskId",
          "filterId",
          "commandType",
          "requestPayload",
          "createdAt",
          "pendingCount",
          "executedCount",
          "expiredCount"
        ]
      },
      "BatchCommandExecutionTaskStatusPageInfo": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval. Current response may return only a part of all available elements."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchCommandExecutionTaskStatus"
            }
          }
        }
      },
      "BatchCommandExecutionItem": {
        "type": "object",
        "properties": {
          "endpointId": {
            "type": "string",
            "description": "Endpoint ID."
          },
          "commandId": {
            "type": "integer",
            "description": "Command ID."
          }
        },
        "required": [
          "commandId"
        ]
      },
      "BatchCommandExecutionStatusResponse": {
        "type": "object",
        "properties": {
          "pending": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchCommandExecutionItem"
            },
            "description": "Array of commands that has 'pending' state."
          },
          "executed": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Array of commands that has 'executed' state."
          },
          "expired": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Array of commands that has 'expired' state."
          }
        },
        "required": [
          "pending",
          "executed",
          "expired"
        ]
      },
      "ClientErrorResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Detailed error description."
          }
        },
        "required": [
          "message"
        ]
      },
      "EndpointLastCommand": {
        "type": "object",
        "properties": {
          "endpointId": {
            "type": "string",
            "description": "Unique endpoint identifier."
          },
          "commands": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "List of last executed commands for each command type for this endpoint. Empty if no commands were found."
          }
        },
        "required": [
          "endpointId",
          "commands"
        ]
      }
    }
  }
}