nextcloud/apps/webhooks/openapi.json
Côme Chilliet d3c06d5dea fix: Fix eventFilter definition in ResponseDefinitions
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-06-11 14:10:29 +02:00

739 lines
No EOL
30 KiB
JSON

{
"openapi": "3.0.3",
"info": {
"title": "webhooks",
"version": "0.0.1",
"description": "Nextcloud webhook support",
"license": {
"name": "agpl"
}
},
"components": {
"securitySchemes": {
"basic_auth": {
"type": "http",
"scheme": "basic"
},
"bearer_auth": {
"type": "http",
"scheme": "bearer"
}
},
"schemas": {
"ListenerInfo": {
"type": "object",
"required": [
"id",
"userId",
"httpMethod",
"uri",
"authMethod"
],
"properties": {
"id": {
"type": "string"
},
"userId": {
"type": "string"
},
"httpMethod": {
"type": "string"
},
"uri": {
"type": "string"
},
"event": {
"type": "string"
},
"eventFilter": {
"type": "object",
"additionalProperties": {
"type": "object"
}
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"authMethod": {
"type": "string"
},
"authData": {
"type": "object",
"additionalProperties": {
"type": "object"
}
}
}
},
"OCSMeta": {
"type": "object",
"required": [
"status",
"statuscode"
],
"properties": {
"status": {
"type": "string"
},
"statuscode": {
"type": "integer"
},
"message": {
"type": "string"
},
"totalitems": {
"type": "string"
},
"itemsperpage": {
"type": "string"
}
}
}
}
},
"paths": {
"/ocs/v2.php/apps/webhooks/api/v1/webhooks": {
"get": {
"operationId": "webhooks-index",
"summary": "List registered webhooks",
"description": "This endpoint requires admin access",
"tags": [
"webhooks"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Webhook registrations returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ListenerInfo"
}
}
}
}
}
}
}
}
}
}
},
"post": {
"operationId": "webhooks-create",
"summary": "Register a new webhook",
"description": "This endpoint requires admin access",
"tags": [
"webhooks"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "httpMethod",
"in": "query",
"description": "HTTP method to use to contact the webhook",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "uri",
"in": "query",
"description": "Webhook URI endpoint",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "event",
"in": "query",
"description": "Event class name to listen to",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "eventFilter",
"in": "query",
"description": "Mongo filter to apply to the serialized data to decide if firing",
"schema": {
"type": "string",
"nullable": true
}
},
{
"name": "headers",
"in": "query",
"description": "Array of headers to send",
"schema": {
"type": "string",
"nullable": true
}
},
{
"name": "authMethod",
"in": "query",
"description": "Authentication method to use",
"schema": {
"type": "string",
"nullable": true,
"enum": [
"none",
"headers"
]
}
},
{
"name": "authData",
"in": "query",
"description": "Array of data for authentication",
"schema": {
"type": "string",
"nullable": true
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Webhook registration returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"$ref": "#/components/schemas/ListenerInfo"
}
}
}
}
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
},
"403": {
"description": "Insufficient permissions",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/apps/webhooks/api/v1/webhooks/{id}": {
"get": {
"operationId": "webhooks-show",
"summary": "Get details on a registered webhook",
"description": "This endpoint requires admin access",
"tags": [
"webhooks"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "id of the webhook",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Webhook registration returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"$ref": "#/components/schemas/ListenerInfo"
}
}
}
}
}
}
}
}
}
},
"post": {
"operationId": "webhooks-update",
"summary": "Update an existing webhook registration",
"description": "This endpoint requires admin access",
"tags": [
"webhooks"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "httpMethod",
"in": "query",
"description": "HTTP method to use to contact the webhook",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "uri",
"in": "query",
"description": "Webhook URI endpoint",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "event",
"in": "query",
"description": "Event class name to listen to",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "eventFilter",
"in": "query",
"description": "Mongo filter to apply to the serialized data to decide if firing",
"schema": {
"type": "string",
"nullable": true
}
},
{
"name": "headers",
"in": "query",
"description": "Array of headers to send",
"schema": {
"type": "string",
"nullable": true
}
},
{
"name": "authMethod",
"in": "query",
"description": "Authentication method to use",
"schema": {
"type": "string",
"nullable": true,
"enum": [
"none",
"headers"
]
}
},
{
"name": "authData",
"in": "query",
"description": "Array of data for authentication",
"schema": {
"type": "string",
"nullable": true
}
},
{
"name": "id",
"in": "path",
"description": "id of the webhook",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Webhook registration returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"$ref": "#/components/schemas/ListenerInfo"
}
}
}
}
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
},
"403": {
"description": "Insufficient permissions",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
},
"delete": {
"operationId": "webhooks-destroy",
"summary": "Remove an existing webhook registration",
"description": "This endpoint requires admin access",
"tags": [
"webhooks"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "id of the webhook",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Boolean returned whether something was deleted FIXME",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "boolean"
}
}
}
}
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
},
"403": {
"description": "Insufficient permissions",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
}
}
},
"tags": []
}