nextcloud/apps/workflowengine/openapi.json
Joas Schilling 4134df9eda
feat(workflowengine): Add openapi for workflow engine
Signed-off-by: Joas Schilling <coding@schilljs.com>
2026-02-16 17:51:18 +01:00

831 lines
35 KiB
JSON

{
"openapi": "3.0.3",
"info": {
"title": "workflowengine",
"version": "0.0.1",
"description": "Nextcloud workflow engine",
"license": {
"name": "agpl"
}
},
"components": {
"securitySchemes": {
"basic_auth": {
"type": "http",
"scheme": "basic"
},
"bearer_auth": {
"type": "http",
"scheme": "bearer"
}
},
"schemas": {
"Check": {
"type": "object",
"required": [
"class",
"value",
"operator"
],
"properties": {
"class": {
"type": "string",
"minLength": 1
},
"value": {
"type": "string"
},
"operator": {
"$ref": "#/components/schemas/Operator"
}
}
},
"OCSMeta": {
"type": "object",
"required": [
"status",
"statuscode"
],
"properties": {
"status": {
"type": "string"
},
"statuscode": {
"type": "integer"
},
"message": {
"type": "string"
},
"totalitems": {
"type": "string"
},
"itemsperpage": {
"type": "string"
}
}
},
"Operator": {
"type": "string",
"enum": [
"is",
"in",
"match",
"less",
"greater",
"matchesIPv4",
"matchesIPv6",
"!is",
"!in",
"!match",
"!less",
"!greater",
"!matchesIPv4",
"!matchesIPv6"
]
},
"Rule": {
"type": "object",
"required": [
"id",
"class",
"name",
"checks",
"operation",
"entity",
"events"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"class": {
"type": "string",
"minLength": 1
},
"name": {
"type": "string"
},
"checks": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Check"
}
},
"operation": {
"type": "string"
},
"entity": {
"type": "string",
"minLength": 1
},
"events": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
}
}
}
}
},
"paths": {
"/ocs/v2.php/apps/workflowengine/api/v1/workflows/user": {
"get": {
"operationId": "user_workflows-index",
"summary": "Retrieve all configured workflow rules",
"tags": [
"user_workflows"
],
"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": "List of workflows returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Rule"
}
}
}
}
}
}
}
}
}
},
"401": {
"description": "Current user is not logged in",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
},
"post": {
"operationId": "user_workflows-create",
"summary": "Create a workflow",
"description": "This endpoint requires password confirmation",
"tags": [
"user_workflows"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"class",
"name",
"checks",
"operation",
"entity",
"events"
],
"properties": {
"class": {
"type": "string",
"description": "Operation class to execute",
"minLength": 1
},
"name": {
"type": "string",
"description": "Name of the workflow rule"
},
"checks": {
"type": "array",
"description": "List of conditions that need to apply for the rule to match",
"items": {
"$ref": "#/components/schemas/Check"
}
},
"operation": {
"type": "string",
"description": "Operation class to execute on match"
},
"entity": {
"type": "string",
"description": "The matched entity"
},
"events": {
"type": "array",
"description": "The list of events on which the rule should be validated",
"items": {
"type": "string",
"minLength": 1
}
}
}
}
}
}
},
"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": "Workflow created",
"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/Rule"
}
}
}
}
}
}
}
},
"400": {
"description": "Thrown when a check or check value is invalid",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
},
"401": {
"description": "Current user is not logged in",
"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/workflowengine/api/v1/workflows/user/{id}": {
"get": {
"operationId": "user_workflows-show",
"summary": "Retrieve a specific workflow",
"tags": [
"user_workflows"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Workflow ID to load",
"required": true,
"schema": {
"type": "string"
}
},
{
"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": "Workflow returned or empty array if the ID is unknown in the scope",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"anyOf": [
{
"$ref": "#/components/schemas/Rule"
},
{
"type": "array",
"maxItems": 0
}
]
}
}
}
}
}
}
}
},
"401": {
"description": "Current user is not logged in",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
},
"put": {
"operationId": "user_workflows-update",
"summary": "Modify a workflow",
"description": "This endpoint requires password confirmation",
"tags": [
"user_workflows"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"name",
"checks",
"operation",
"entity",
"events"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the workflow rule"
},
"checks": {
"type": "array",
"description": "List of conditions that need to apply for the rule to match",
"items": {
"$ref": "#/components/schemas/Check"
}
},
"operation": {
"type": "string",
"description": "Operation action to execute on match"
},
"entity": {
"type": "string",
"description": "The matched entity"
},
"events": {
"type": "array",
"description": "The list of events on which the rule should be validated",
"items": {
"type": "string",
"minLength": 1
}
}
}
}
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"description": "Workflow ID to delete",
"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": "Workflow updated",
"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/Rule"
}
}
}
}
}
}
}
},
"400": {
"description": "Thrown when a check or check value is invalid",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
},
"403": {
"description": "Thrown when workflow is from a different scope",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
},
"401": {
"description": "Current user is not logged in",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
},
"delete": {
"operationId": "user_workflows-destroy",
"summary": "Delete a workflow",
"description": "This endpoint requires password confirmation",
"tags": [
"user_workflows"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Workflow ID to delete",
"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": "Workflow deleted",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "boolean"
}
}
}
}
}
}
}
},
"403": {
"description": "Thrown when workflow is from a different scope",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
},
"401": {
"description": "Current user is not logged in",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
}
}
},
"tags": []
}