diff --git a/oas_docs/bundle.json b/oas_docs/bundle.json index f8ef17734e065..5b24d56d09730 100644 --- a/oas_docs/bundle.json +++ b/oas_docs/bundle.json @@ -1222,7 +1222,7 @@ }, "/api/agent_builder/agents": { "get": { - "description": "List all available agents. Use this endpoint to retrieve complete agent information including their current configuration and assigned tools.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "List all available agents. Use this endpoint to retrieve complete agent information including their current configuration and assigned tools. To learn more, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "get-agent-builder-agents", "parameters": [], "responses": { @@ -1293,7 +1293,7 @@ "x-state": "Added in 9.2.0" }, "post": { - "description": "Create a new agent. Use this endpoint to define the agent's behavior, appearance, and capabilities through comprehensive configuration options.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Create a new agent. Use this endpoint to define the agent's behavior, appearance, and capabilities through comprehensive configuration options. To learn more, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "post-agent-builder-agents", "parameters": [ { @@ -1465,7 +1465,7 @@ }, "/api/agent_builder/agents/{id}": { "delete": { - "description": "Delete an agent by ID. This action cannot be undone.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Delete an agent by ID. This action cannot be undone. To learn more, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "delete-agent-builder-agents-id", "parameters": [ { @@ -1512,7 +1512,7 @@ "x-state": "Added in 9.2.0" }, "get": { - "description": "Get a specific agent by ID. Use this endpoint to retrieve the complete agent definition including all configuration details and tool assignments.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "Get a specific agent by ID. Use this endpoint to retrieve the complete agent definition including all configuration details and tool assignments. To learn more, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "get-agent-builder-agents-id", "parameters": [ { @@ -1571,7 +1571,7 @@ "x-state": "Added in 9.2.0" }, "put": { - "description": "Update an existing agent configuration. Use this endpoint to modify any aspect of the agent's behavior, appearance, or capabilities.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Update an existing agent configuration. Use this endpoint to modify any aspect of the agent's behavior, appearance, or capabilities. To learn more, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "put-agent-builder-agents-id", "parameters": [ { @@ -2483,7 +2483,7 @@ }, "/api/agent_builder/converse": { "post": { - "description": "Send a message to an agent and receive a complete response. This synchronous endpoint waits for the agent to fully process your request before returning the final result. Use this for simple chat interactions where you need the complete response.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "Send a message to an agent and receive a complete response. This synchronous endpoint waits for the agent to fully process your request before returning the final result. Use this for simple chat interactions where you need the complete response. To learn more, refer to the [agent chat documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/chat).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "post-agent-builder-converse", "parameters": [ { @@ -2954,9 +2954,19 @@ }, "/api/agent_builder/mcp": { "post": { - "description": "> warn\n> This endpoint is designed for MCP clients (Claude Desktop, Cursor, VS Code, etc.) and should not be used directly via REST APIs. Use MCP Inspector or native MCP clients instead.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "> warn\n> This endpoint is designed for MCP clients (Claude Desktop, Cursor, VS Code, etc.) and should not be used directly via REST APIs. Use MCP Inspector or native MCP clients instead.\nTo learn more, refer to the [MCP documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/mcp-server).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "post-agent-builder-mcp", - "parameters": [], + "parameters": [ + { + "description": "Comma-separated list of namespaces to filter tools. Only tools matching the specified namespaces will be returned.", + "in": "query", + "name": "namespace", + "required": false, + "schema": { + "type": "string" + } + } + ], "requestBody": { "content": { "application/json": { @@ -3021,7 +3031,7 @@ }, "/api/agent_builder/tools": { "get": { - "description": "List all available tools. Use this endpoint to retrieve complete tool definitions including their schemas and configuration requirements.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "List all available tools. Use this endpoint to retrieve complete tool definitions including their schemas and configuration requirements. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "get-agent-builder-tools", "parameters": [], "responses": { @@ -3195,7 +3205,7 @@ "x-state": "Added in 9.2.0" }, "post": { - "description": "Create a new tool. Use this endpoint to define a custom tool with specific functionality and configuration for use by agents.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Create a new tool. Use this endpoint to define a custom tool with specific functionality and configuration for use by agents. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "post-agent-builder-tools", "parameters": [ { @@ -3398,7 +3408,7 @@ }, "/api/agent_builder/tools/_execute": { "post": { - "description": "Execute a tool with parameters. Use this endpoint to run a tool directly with specified inputs and optional external connector integration.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "Execute a tool with parameters. Use this endpoint to run a tool directly with specified inputs and optional external connector integration. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "post-agent-builder-tools-execute", "parameters": [ { @@ -3703,7 +3713,7 @@ }, "/api/agent_builder/tools/{toolId}": { "delete": { - "description": "Delete a tool by ID. This action cannot be undone.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Delete a tool by ID. This action cannot be undone. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "delete-agent-builder-tools-toolid", "parameters": [ { @@ -3750,7 +3760,7 @@ "x-state": "Added in 9.2.0" }, "get": { - "description": "Get a specific tool by ID. Use this endpoint to retrieve the complete tool definition including its schema and configuration requirements.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "Get a specific tool by ID. Use this endpoint to retrieve the complete tool definition including its schema and configuration requirements. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "get-agent-builder-tools-toolid", "parameters": [ { @@ -3887,7 +3897,7 @@ "x-state": "Added in 9.2.0" }, "put": { - "description": "Update an existing tool. Use this endpoint to modify any aspect of the tool's configuration or metadata.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Update an existing tool. Use this endpoint to modify any aspect of the tool's configuration or metadata. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "put-agent-builder-tools-toolid", "parameters": [ { @@ -57355,6 +57365,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -62268,6 +62301,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { @@ -65416,6 +65450,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -70329,6 +70386,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { @@ -73011,6 +73069,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -77924,6 +78005,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { @@ -80721,6 +80803,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -85634,6 +85739,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { @@ -88269,6 +88375,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -93182,6 +93311,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { @@ -95790,6 +95920,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -100703,6 +100856,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { diff --git a/oas_docs/bundle.serverless.json b/oas_docs/bundle.serverless.json index e95f2b7d8af5a..a484eca3e7e04 100644 --- a/oas_docs/bundle.serverless.json +++ b/oas_docs/bundle.serverless.json @@ -1222,7 +1222,7 @@ }, "/api/agent_builder/agents": { "get": { - "description": "List all available agents. Use this endpoint to retrieve complete agent information including their current configuration and assigned tools.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "List all available agents. Use this endpoint to retrieve complete agent information including their current configuration and assigned tools. To learn more, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "get-agent-builder-agents", "parameters": [], "responses": { @@ -1293,7 +1293,7 @@ "x-state": "" }, "post": { - "description": "Create a new agent. Use this endpoint to define the agent's behavior, appearance, and capabilities through comprehensive configuration options.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Create a new agent. Use this endpoint to define the agent's behavior, appearance, and capabilities through comprehensive configuration options. To learn more, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "post-agent-builder-agents", "parameters": [ { @@ -1465,7 +1465,7 @@ }, "/api/agent_builder/agents/{id}": { "delete": { - "description": "Delete an agent by ID. This action cannot be undone.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Delete an agent by ID. This action cannot be undone. To learn more, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "delete-agent-builder-agents-id", "parameters": [ { @@ -1512,7 +1512,7 @@ "x-state": "" }, "get": { - "description": "Get a specific agent by ID. Use this endpoint to retrieve the complete agent definition including all configuration details and tool assignments.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "Get a specific agent by ID. Use this endpoint to retrieve the complete agent definition including all configuration details and tool assignments. To learn more, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "get-agent-builder-agents-id", "parameters": [ { @@ -1571,7 +1571,7 @@ "x-state": "" }, "put": { - "description": "Update an existing agent configuration. Use this endpoint to modify any aspect of the agent's behavior, appearance, or capabilities.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Update an existing agent configuration. Use this endpoint to modify any aspect of the agent's behavior, appearance, or capabilities. To learn more, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "put-agent-builder-agents-id", "parameters": [ { @@ -2483,7 +2483,7 @@ }, "/api/agent_builder/converse": { "post": { - "description": "Send a message to an agent and receive a complete response. This synchronous endpoint waits for the agent to fully process your request before returning the final result. Use this for simple chat interactions where you need the complete response.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "Send a message to an agent and receive a complete response. This synchronous endpoint waits for the agent to fully process your request before returning the final result. Use this for simple chat interactions where you need the complete response. To learn more, refer to the [agent chat documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/chat).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "post-agent-builder-converse", "parameters": [ { @@ -2954,9 +2954,19 @@ }, "/api/agent_builder/mcp": { "post": { - "description": "> warn\n> This endpoint is designed for MCP clients (Claude Desktop, Cursor, VS Code, etc.) and should not be used directly via REST APIs. Use MCP Inspector or native MCP clients instead.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "> warn\n> This endpoint is designed for MCP clients (Claude Desktop, Cursor, VS Code, etc.) and should not be used directly via REST APIs. Use MCP Inspector or native MCP clients instead.\nTo learn more, refer to the [MCP documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/mcp-server).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "post-agent-builder-mcp", - "parameters": [], + "parameters": [ + { + "description": "Comma-separated list of namespaces to filter tools. Only tools matching the specified namespaces will be returned.", + "in": "query", + "name": "namespace", + "required": false, + "schema": { + "type": "string" + } + } + ], "requestBody": { "content": { "application/json": { @@ -3021,7 +3031,7 @@ }, "/api/agent_builder/tools": { "get": { - "description": "List all available tools. Use this endpoint to retrieve complete tool definitions including their schemas and configuration requirements.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "List all available tools. Use this endpoint to retrieve complete tool definitions including their schemas and configuration requirements. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "get-agent-builder-tools", "parameters": [], "responses": { @@ -3195,7 +3205,7 @@ "x-state": "" }, "post": { - "description": "Create a new tool. Use this endpoint to define a custom tool with specific functionality and configuration for use by agents.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Create a new tool. Use this endpoint to define a custom tool with specific functionality and configuration for use by agents. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "post-agent-builder-tools", "parameters": [ { @@ -3398,7 +3408,7 @@ }, "/api/agent_builder/tools/_execute": { "post": { - "description": "Execute a tool with parameters. Use this endpoint to run a tool directly with specified inputs and optional external connector integration.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "Execute a tool with parameters. Use this endpoint to run a tool directly with specified inputs and optional external connector integration. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "post-agent-builder-tools-execute", "parameters": [ { @@ -3703,7 +3713,7 @@ }, "/api/agent_builder/tools/{toolId}": { "delete": { - "description": "Delete a tool by ID. This action cannot be undone.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Delete a tool by ID. This action cannot be undone. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "delete-agent-builder-tools-toolid", "parameters": [ { @@ -3750,7 +3760,7 @@ "x-state": "" }, "get": { - "description": "Get a specific tool by ID. Use this endpoint to retrieve the complete tool definition including its schema and configuration requirements.

[Required authorization] Route required privileges: read_agent_builder.", + "description": "Get a specific tool by ID. Use this endpoint to retrieve the complete tool definition including its schema and configuration requirements. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: read_agent_builder.", "operationId": "get-agent-builder-tools-toolid", "parameters": [ { @@ -3887,7 +3897,7 @@ "x-state": "" }, "put": { - "description": "Update an existing tool. Use this endpoint to modify any aspect of the tool's configuration or metadata.

[Required authorization] Route required privileges: manage_agent_builder.", + "description": "Update an existing tool. Use this endpoint to modify any aspect of the tool's configuration or metadata. To learn more, refer to the [tools documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/tools).

[Required authorization] Route required privileges: manage_agent_builder.", "operationId": "put-agent-builder-tools-toolid", "parameters": [ { @@ -56423,6 +56433,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -61336,6 +61369,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { @@ -64484,6 +64518,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -69397,6 +69454,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { @@ -72079,6 +72137,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -76992,6 +77073,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { @@ -79789,6 +79871,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -84702,6 +84807,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { @@ -87337,6 +87443,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -92250,6 +92379,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { @@ -94858,6 +94988,29 @@ "description": "A non-empty string.", "minLength": 1, "type": "string" + }, + "downsample": { + "items": { + "additionalProperties": false, + "properties": { + "after": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + }, + "fixed_interval": { + "description": "A non-empty string.", + "minLength": 1, + "type": "string" + } + }, + "required": [ + "after", + "fixed_interval" + ], + "type": "object" + }, + "type": "array" } }, "type": "object" @@ -99771,6 +99924,7 @@ "minLength": 1, "type": "string" }, + "minItems": 1, "type": "array" }, "ignore_failure": { diff --git a/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/service.test.ts b/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/service.test.ts index 301768fbb70bb..988ca022b1e8e 100644 --- a/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/service.test.ts +++ b/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/service.test.ts @@ -1397,6 +1397,48 @@ describe('Cases webhook service', () => { '[Action][Webhook - Case Management]: Unable to update case with id 1. Error: Unsupported content type: text/html in GET https://example.com. Supported content types: application/json.' ); }); + + it('it should throw if the request status is a 204 and has data', async () => { + requestMock.mockImplementation(() => + createAxiosResponse({ + data: 'some data', + headers: { ['content-type']: 'text/html' }, + status: 204, + }) + ); + + await expect(service.updateIncident(incident)).rejects.toThrow( + '[Action][Webhook - Case Management]: Unable to update case with id 1. Error: Unsupported content type: text/html in GET https://example.com. Supported content types: application/json.' + ); + }); + + it('it should NOT throw if the request status is a 204 and is empty', async () => { + // Initial mock for the update call + requestMock.mockImplementationOnce(() => + createAxiosResponse({ + data: undefined, + headers: { ['content-type']: 'text/html' }, + status: 204, + }) + ); + + // Second mock for the getIncident call inside updateIncident + requestMock.mockImplementationOnce(() => + createAxiosResponse({ + data: { + id: '1', + key: 'CK-1', + }, + }) + ); + + await expect(service.updateIncident(incident)).resolves.toEqual({ + id: '1', + title: 'CK-1', + pushedDate: mockTime.toISOString(), + url: 'https://coolsite.net/browse/CK-1', + }); + }); }); describe('createComment', () => { diff --git a/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/utils.test.ts b/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/utils.test.ts index 8e73e1d6682fd..a069e11869fb4 100644 --- a/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/utils.test.ts +++ b/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/utils.test.ts @@ -64,6 +64,32 @@ describe('cases_webhook/utils', () => { headers: new AxiosHeaders({}), }, }; + + it('Does not throw when the response status is 204 and there is no data', () => { + expect(() => + throwDescriptiveErrorIfResponseIsNotValid({ + res: { + ...res, + status: 204, + data: undefined, + }, + }) + ).not.toThrow(); + }); + + it('Throws when the response status is 204 and requiredAttributesToBeInTheResponse is set', () => { + expect(() => + throwDescriptiveErrorIfResponseIsNotValid({ + res: { + ...res, + status: 204, + data: undefined, + }, + requiredAttributesToBeInTheResponse: ['field.simple'], + }) + ).toThrow(); + }); + it('Throws error when missing content-type', () => { expect(() => throwDescriptiveErrorIfResponseIsNotValid({ diff --git a/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/utils.ts b/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/utils.ts index 6013dae31e1ac..fba45fcaae58c 100644 --- a/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/utils.ts +++ b/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/cases_webhook/utils.ts @@ -43,6 +43,11 @@ export const throwDescriptiveErrorIfResponseIsNotValid = ({ const contentType = res.headers['content-type']; const data = res.data; + // If status is 204 and there is no data, we just return + if (res.status === 204 && isEmpty(data) && requiredAttributesToBeInTheResponse.length === 0) { + return; + } + /** * Check that the content-type of the response is application/json. * Then includes is added because the header can be application/json;charset=UTF-8.