diff --git a/codegen.sh b/codegen.sh index 57b20e084..a452a3f76 100755 --- a/codegen.sh +++ b/codegen.sh @@ -131,6 +131,13 @@ function provision { green "OK" } +function openapidocs { + yellow "> openapidocs" + rm -f docs/static.go + $GOPATH/bin/statik -p docs -m -Z -f -src=./docs + green "OK" +} + function events { if [ ! -f "build/event-gen" ]; then diff --git a/codegen/compose/docs/index.php b/codegen/compose/docs/index.php index 9a16afe43..4f11bbf65 100644 --- a/codegen/compose/docs/index.php +++ b/codegen/compose/docs/index.php @@ -38,7 +38,7 @@ foreach ($apis as $k => $api) { $apis[$k] = $api; } -$tpl->load("README.tpl"); -$tpl->assign("apis", $apis); -file_put_contents($dirname . "README.md", $cleanUp($tpl->get())); -echo $dirname . "README.md\n"; \ No newline at end of file +// $tpl->load("README.tpl"); +// $tpl->assign("apis", $apis); +// file_put_contents($dirname . "README.md", $cleanUp($tpl->get())); +// echo $dirname . "README.md\n"; diff --git a/codegen/messaging/docs/index.php b/codegen/messaging/docs/index.php index 9a16afe43..4f11bbf65 100644 --- a/codegen/messaging/docs/index.php +++ b/codegen/messaging/docs/index.php @@ -38,7 +38,7 @@ foreach ($apis as $k => $api) { $apis[$k] = $api; } -$tpl->load("README.tpl"); -$tpl->assign("apis", $apis); -file_put_contents($dirname . "README.md", $cleanUp($tpl->get())); -echo $dirname . "README.md\n"; \ No newline at end of file +// $tpl->load("README.tpl"); +// $tpl->assign("apis", $apis); +// file_put_contents($dirname . "README.md", $cleanUp($tpl->get())); +// echo $dirname . "README.md\n"; diff --git a/codegen/system/docs/index.php b/codegen/system/docs/index.php index 9a16afe43..4f11bbf65 100644 --- a/codegen/system/docs/index.php +++ b/codegen/system/docs/index.php @@ -38,7 +38,7 @@ foreach ($apis as $k => $api) { $apis[$k] = $api; } -$tpl->load("README.tpl"); -$tpl->assign("apis", $apis); -file_put_contents($dirname . "README.md", $cleanUp($tpl->get())); -echo $dirname . "README.md\n"; \ No newline at end of file +// $tpl->load("README.tpl"); +// $tpl->assign("apis", $apis); +// file_put_contents($dirname . "README.md", $cleanUp($tpl->get())); +// echo $dirname . "README.md\n"; diff --git a/docs/README.adoc b/docs/README.adoc new file mode 100644 index 000000000..98fff987c --- /dev/null +++ b/docs/README.adoc @@ -0,0 +1,17 @@ +# Corteza API documentation + +WARNING: Work in progress + +This is the first step in migration towards full OpenAPI standards support.` + +## Original/starting state (pre `2020.9`; deprecated): +Home-brew API definition format in JSON, still available under `api/*/spec.json`. +This is still needed for controller/request/handler codegens. Documentation generators are disabled. + +## Current state (`2020.9`) +In branch `2020.12.x` we're experimenting with first step toward conversion to OpenAPI 3.0 YAML files for API +definition. There is a converter available in https://github.com/cortezaproject/openapi3-converter[cortezaproject/openapi3-converter] +that takes those custom YAML files and converts them to OpenAPI format. + +## Goal (target `2020.12`) +Generate HTTP handlers and all auxilary code and documentation from YAML files in OpenAPI 3.0 format diff --git a/docs/compose.yaml b/docs/compose.yaml new file mode 100644 index 000000000..1469f7482 --- /dev/null +++ b/docs/compose.yaml @@ -0,0 +1,1931 @@ +openapi: 3.0.0 +info: + title: Corteza compose API + description: Corteza compose REST API definition + version: 2020.9 + contact: + email: info@cortezaproject.org + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /namespace/: + get: + tags: + - Namespaces + summary: List namespaces + responses: + '200': + description: OK + parameters: + - in: query + name: query + description: Search query + required: false + schema: &ref_0 + type: string + - in: query + name: slug + description: Search by namespace slug + required: false + schema: *ref_0 + - in: query + name: limit + description: Limit + required: false + schema: &ref_5 + type: string + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_0 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_0 + post: + tags: + - Namespaces + summary: Create namespace + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_1 + name: + type: string + description: Name + slug: + type: string + description: Slug (url path part) + enabled: + type: boolean + description: Enabled + meta: + type: string + format: json + description: Meta data + required: + - name + - meta + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_1 + '/namespace/{namespaceID}': + get: + tags: + - Namespaces + summary: Read namespace + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: ID + required: true + schema: &ref_2 + type: string + post: + tags: + - Namespaces + summary: Update namespace + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_3 + name: + type: string + description: Name + slug: + type: string + description: Slug (url path part) + enabled: + type: boolean + description: Enabled + meta: + type: string + format: json + description: Meta data + updatedAt: + type: string + format: date-time + description: Last update (or creation) date + required: + - name + - meta + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_3 + delete: + tags: + - Namespaces + summary: Delete namespace + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/trigger': + post: + tags: + - Namespaces + summary: 'Fire compose:namespace trigger' + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_4 + script: + type: string + description: Script to execute + required: + - script + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_4 + '/namespace/{namespaceID}/page/': + get: + tags: + - Pages + summary: List available pages + responses: + '200': + description: OK + parameters: + - in: query + name: selfID + description: Parent page ID + required: false + schema: *ref_2 + - in: query + name: query + description: Search query + required: false + schema: *ref_0 + - in: query + name: handle + description: Search by handle + required: false + schema: *ref_0 + - in: query + name: limit + description: Limit + required: false + schema: *ref_5 + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_0 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_0 + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + post: + tags: + - Pages + summary: Create page + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_6 + selfID: + type: string + description: Parent Page ID + moduleID: + type: string + description: Module ID + title: + type: string + description: Title + handle: + type: string + description: Handle + description: + type: string + description: Description + weight: + type: integer + description: Page tree weight + visible: + type: boolean + description: Visible in navigation + blocks: + type: string + format: json + description: Blocks JSON + required: + - title + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_6 + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/page/{pageID}': + get: + tags: + - Pages + summary: Get page details + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: pageID + description: Page ID + required: true + schema: *ref_2 + post: + tags: + - Pages + summary: Update page + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: pageID + description: Page ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_7 + selfID: + type: string + description: Parent Page ID + moduleID: + type: string + description: Module ID (optional) + title: + type: string + description: Title + handle: + type: string + description: Handle + description: + type: string + description: Description + weight: + type: integer + description: Page tree weight + visible: + type: boolean + description: Visible in navigation + blocks: + type: string + format: json + description: Blocks JSON + required: + - title + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_7 + delete: + tags: + - Pages + summary: Delete page + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: pageID + description: Page ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/page/tree': + get: + tags: + - Pages + summary: 'Get page all (non-record) pages, hierarchically' + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/page/{selfID}/reorder': + post: + tags: + - Pages + summary: Reorder pages + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: selfID + description: Parent page ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_8 + pageIDs: + type: array + items: *ref_0 + description: Page ID order + required: + - pageIDs + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_8 + '/namespace/{namespaceID}/page/{pageID}/attachment': + post: + tags: + - Pages + summary: Uploads attachment to page + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: pageID + description: Page ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_9 + upload: + type: string + format: binary + description: File to upload + required: + - upload + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_9 + '/namespace/{namespaceID}/page/{pageID}/trigger': + post: + tags: + - Pages + summary: 'Fire compose:page trigger' + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: pageID + description: Page ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_10 + script: + type: string + description: Script to execute + required: + - script + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_10 + '/namespace/{namespaceID}/module/': + get: + tags: + - Modules + summary: List modules + responses: + '200': + description: OK + parameters: + - in: query + name: query + description: Search query + required: false + schema: *ref_0 + - in: query + name: name + description: Search by name + required: false + schema: *ref_0 + - in: query + name: handle + description: Search by handle + required: false + schema: *ref_0 + - in: query + name: limit + description: Limit + required: false + schema: *ref_5 + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_0 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_0 + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + post: + tags: + - Modules + summary: Create module + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_11 + name: + type: string + description: Module Name + handle: + type: string + description: Module handle + fields: + type: array + items: &ref_12 + type: object + properties: + fieldID: + type: string + format: uuid + name: + type: string + kind: + type: string + label: + type: string + defaultValue: + type: array + items: + type: string + maxLength: + type: integer + isRequired: + type: boolean + isPrivate: + type: boolean + isMulti: + type: boolean + isSystem: + type: boolean + options: + type: object + description: Fields JSON + meta: + type: string + format: json + description: Module meta data + required: + - name + - fields + - meta + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_11 + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/module/{moduleID}': + get: + tags: + - Modules + summary: Read module + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + post: + tags: + - Modules + summary: Update module + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_13 + name: + type: string + description: Module Name + handle: + type: string + description: Module Handle + fields: + type: array + items: *ref_12 + description: Fields JSON + meta: + type: string + format: json + description: Module meta data + updatedAt: + type: string + format: date-time + description: Last update (or creation) date + required: + - name + - fields + - meta + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_13 + delete: + tags: + - Modules + summary: Delete module + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/module/{moduleID}/trigger': + post: + tags: + - Modules + summary: 'Fire compose:module trigger' + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_14 + script: + type: string + description: Script to execute + required: + - script + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_14 + '/namespace/{namespaceID}/module/{moduleID}/record/report': + get: + tags: + - Records + summary: Generates report from module records + responses: + '200': + description: OK + parameters: + - in: query + name: metrics + description: 'Metrics (eg: ''SUM(money), MAX(calls)'')' + required: false + schema: *ref_0 + - in: query + name: dimensions + description: 'Dimensions (eg: ''DATE(foo), status'')' + required: true + schema: *ref_0 + - in: query + name: filter + description: 'Filter (eg: ''DATE(foo) > 2010'')' + required: false + schema: *ref_0 + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/module/{moduleID}/record/': + get: + tags: + - Records + summary: List/read records from module section + responses: + '200': + description: OK + parameters: + - in: query + name: query + description: Record filtering query + required: false + schema: *ref_0 + - in: query + name: filter + description: 'Filtering condition (same as query, deprecated)' + required: false + schema: *ref_0 + - in: query + name: deleted + description: 'Exclude (0, default), include (1) or return only (2) deleted records' + required: false + schema: *ref_5 + - in: query + name: limit + description: Limit + required: false + schema: *ref_5 + - in: query + name: offset + description: Offset + required: false + schema: *ref_5 + - in: query + name: page + description: Page number (1-based) + required: false + schema: *ref_5 + - in: query + name: perPage + description: Returned items per page (default 50) + required: false + schema: *ref_5 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_0 + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + post: + tags: + - Records + summary: Create record in module section + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_15 + values: + type: array + items: &ref_20 + type: object + properties: + name: + type: string + value: + type: string + description: Record values + records: + type: array + items: &ref_21 + type: object + properties: + recordID: + type: string + format: uuid + moduleID: + type: string + format: uuid + namespaceID: + type: string + format: uuid + values: + type: array + items: + type: object + properties: + name: + type: string + value: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + deletedAt: + type: string + format: date-time + ownedBy: + type: string + format: uuid + createdBy: + type: string + format: uuid + updatedBy: + type: string + format: uuid + deletedBy: + type: string + format: uuid + description: Records + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_15 + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + delete: + tags: + - Records + summary: Delete record row from module section + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_16 + recordIDs: + type: array + items: *ref_0 + description: IDs of records to delete + truncate: + type: boolean + description: >- + Remove ALL records of a specified module (pending + implementation) + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_16 + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/module/{moduleID}/record/import': + post: + tags: + - Records + summary: Initiate record import session + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_17 + upload: + type: string + format: binary + description: File import + required: + - upload + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_17 + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/module/{moduleID}/record/import/{sessionID}': + patch: + tags: + - Records + summary: Run record import + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + - in: path + name: sessionID + description: Import session + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_18 + fields: + type: string + format: json + description: Fields defined by import file + onError: + type: string + description: What happens if record fails to import + required: + - fields + - onError + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_18 + get: + tags: + - Records + summary: Get import progress + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + - in: path + name: sessionID + description: Import session + required: true + schema: *ref_2 + '/namespace/{namespaceID}/module/{moduleID}/record/export{filename}.{ext}': + get: + tags: + - Records + summary: 'Exports records that match ' + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + - in: path + name: filename + description: Filename to use + required: true + schema: *ref_0 + - in: path + name: ext + description: Export format + required: true + schema: *ref_0 + - in: query + name: filter + description: Filtering condition + required: false + schema: *ref_0 + - in: query + name: fields + description: Fields to export + required: true + schema: + type: array + items: *ref_0 + - in: query + name: timezone + description: Convert times to this timezone + required: false + schema: *ref_0 + '/namespace/{namespaceID}/module/{moduleID}/record/exec/{procedure}': + post: + tags: + - Records + summary: Executes server-side procedure over one or more module records + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + - in: path + name: procedure + description: Name of procedure to execute + required: true + schema: *ref_0 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_19 + args: + type: array + items: + type: object + properties: + name: + type: string + value: + type: string + description: Procedure arguments + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_19 + '/namespace/{namespaceID}/module/{moduleID}/record/{recordID}': + get: + tags: + - Records + summary: Read records by ID from module section + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + - in: path + name: recordID + description: Record ID + required: true + schema: *ref_2 + post: + tags: + - Records + summary: Update records in module section + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + - in: path + name: recordID + description: Record ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_22 + values: + type: array + items: *ref_20 + description: Record values + records: + type: array + items: *ref_21 + description: Records + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_22 + delete: + tags: + - Records + summary: Delete record row from module section + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + - in: path + name: recordID + description: Record ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/module/{moduleID}/record/attachment': + post: + tags: + - Records + summary: Uploads attachment and validates it against record field requirements + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_23 + recordID: + type: string + description: Record ID + fieldName: + type: string + description: Field name + upload: + type: string + format: binary + description: File to upload + required: + - fieldName + - upload + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_23 + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/module/{moduleID}/record/{recordID}/trigger': + post: + tags: + - Records + summary: 'Fire compose:record trigger' + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + - in: path + name: recordID + description: ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_24 + script: + type: string + description: Script to execute + values: + type: array + items: *ref_20 + description: Record values + required: + - script + - values + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_24 + '/namespace/{namespaceID}/module/{moduleID}/record/trigger': + post: + tags: + - Records + summary: 'Fire compose:record trigger' + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_25 + script: + type: string + description: Script to execute + required: + - script + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_25 + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: moduleID + description: Module ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/chart/': + get: + tags: + - Charts + summary: List/read charts + responses: + '200': + description: OK + parameters: + - in: query + name: query + description: Search query to match against charts + required: false + schema: *ref_0 + - in: query + name: handle + description: Search charts by handle + required: false + schema: *ref_0 + - in: query + name: limit + description: Limit + required: false + schema: *ref_5 + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_0 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_0 + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + post: + tags: + - Charts + summary: 'List/read charts ' + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_26 + config: + type: string + format: json + description: Chart JSON + name: + type: string + description: Chart name + handle: + type: string + description: Chart handle + required: + - config + - name + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_26 + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/chart/{chartID}': + get: + tags: + - Charts + summary: Read charts by ID + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: chartID + description: Chart ID + required: true + schema: *ref_2 + post: + tags: + - Charts + summary: Add/update charts + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: chartID + description: Chart ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_27 + config: + type: string + format: json + description: Chart JSON + name: + type: string + description: Chart name + handle: + type: string + description: Chart handle + updatedAt: + type: string + format: date-time + description: Last update (or creation) date + required: + - config + - name + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_27 + delete: + tags: + - Charts + summary: Delete chart + responses: + '200': + description: OK + parameters: + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: chartID + description: Chart ID + required: true + schema: *ref_2 + /notification/email: + post: + tags: + - Notifications + summary: Send email from the Compose + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_28 + to: + type: array + items: *ref_0 + description: Email addresses + cc: + type: array + items: *ref_0 + description: Email addresses + replyTo: + type: string + description: Email address in reply-to field + subject: + type: string + description: Email subject + content: + type: string + format: json + description: Message content + remoteAttachments: + type: array + items: *ref_0 + description: Remote files to attach to the email + required: + - to + - content + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_28 + '/namespace/{namespaceID}/attachment/{kind}/': + get: + tags: + - Attachments + summary: 'List, filter all page attachments' + responses: + '200': + description: OK + parameters: + - in: query + name: sign + description: Signature + required: false + schema: *ref_0 + - in: query + name: userID + description: User ID + required: false + schema: *ref_2 + - in: query + name: pageID + description: Filter attachments by page ID + required: false + schema: *ref_2 + - in: query + name: moduleID + description: Filter attachments by module ID + required: false + schema: *ref_2 + - in: query + name: recordID + description: Filter attachments by record ID + required: false + schema: *ref_2 + - in: query + name: fieldName + description: Filter attachments by field name + required: false + schema: *ref_0 + - in: query + name: limit + description: Limit + required: false + schema: *ref_5 + - in: query + name: offset + description: Offset + required: false + schema: *ref_5 + - in: query + name: page + description: Page number (1-based) + required: false + schema: *ref_5 + - in: query + name: perPage + description: Returned items per page (default 50) + required: false + schema: *ref_5 + - in: path + name: kind + description: Attachment kind + required: true + schema: *ref_0 + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + '/namespace/{namespaceID}/attachment/{kind}/{attachmentID}': + get: + tags: + - Attachments + summary: Attachment details + responses: + '200': + description: OK + parameters: + - in: path + name: kind + description: Attachment kind + required: true + schema: *ref_0 + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: attachmentID + description: Attachment ID + required: true + schema: *ref_2 + - in: query + name: sign + description: Signature + required: false + schema: *ref_0 + - in: query + name: userID + description: User ID + required: false + schema: *ref_2 + delete: + tags: + - Attachments + summary: Delete attachment + responses: + '200': + description: OK + parameters: + - in: path + name: kind + description: Attachment kind + required: true + schema: *ref_0 + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: attachmentID + description: Attachment ID + required: true + schema: *ref_2 + - in: query + name: sign + description: Signature + required: false + schema: *ref_0 + - in: query + name: userID + description: User ID + required: false + schema: *ref_2 + '/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/original/{name}': + get: + tags: + - Attachments + summary: Serves attached file + responses: + '200': + description: OK + parameters: + - in: path + name: kind + description: Attachment kind + required: true + schema: *ref_0 + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: attachmentID + description: Attachment ID + required: true + schema: *ref_2 + - in: path + name: name + description: File name + required: true + schema: *ref_0 + - in: query + name: sign + description: Signature + required: false + schema: *ref_0 + - in: query + name: userID + description: User ID + required: false + schema: *ref_2 + - in: query + name: download + description: Force file download + required: false + schema: &ref_30 + type: boolean + '/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/preview.{ext}': + get: + tags: + - Attachments + summary: Serves preview of an attached file + responses: + '200': + description: OK + parameters: + - in: path + name: kind + description: Attachment kind + required: true + schema: *ref_0 + - in: path + name: namespaceID + description: Namespace ID + required: true + schema: *ref_2 + - in: path + name: attachmentID + description: Attachment ID + required: true + schema: *ref_2 + - in: path + name: ext + description: Preview extension/format + required: true + schema: *ref_0 + - in: query + name: sign + description: Signature + required: false + schema: *ref_0 + - in: query + name: userID + description: User ID + required: false + schema: *ref_2 + /permissions/: + get: + tags: + - Permissions + summary: Retrieve defined permissions + responses: + '200': + description: OK + /permissions/effective: + get: + tags: + - Permissions + summary: Effective rules for current user + responses: + '200': + description: OK + parameters: + - in: query + name: resource + description: Show only rules for a specific resource + required: false + schema: *ref_0 + '/permissions/{roleID}/rules': + get: + tags: + - Permissions + summary: Retrieve role permissions + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_2 + delete: + tags: + - Permissions + summary: Remove all defined role permissions + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_2 + patch: + tags: + - Permissions + summary: Update permission settings + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_29 + rules: + type: array + items: + type: object + properties: + roleID: + type: string + format: uuid + resource: + type: string + operation: + type: string + access: + type: string + description: List of permission rules to set + required: + - rules + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_29 + /automation/: + get: + tags: + - Compose automation scripts + summary: List all available automation scripts for compose resources + responses: + '200': + description: OK + parameters: + - in: query + name: resourceTypePrefixes + description: Filter by resource prefix + required: false + schema: + type: array + items: *ref_0 + - in: query + name: resourceTypes + description: Filter by resource type + required: false + schema: + type: array + items: *ref_0 + - in: query + name: eventTypes + description: Filter by event type + required: false + schema: + type: array + items: *ref_0 + - in: query + name: excludeInvalid + description: Exclude scripts that can not be used (errors) + required: false + schema: *ref_30 + - in: query + name: excludeClientScripts + description: Do not include client scripts + required: false + schema: *ref_30 + - in: query + name: excludeServerScripts + description: Do not include server scripts + required: false + schema: *ref_30 + '/automation/{bundle}-{type}.{ext}': + get: + tags: + - Compose automation scripts + summary: Serves client scripts bundle + responses: + '200': + description: OK + parameters: + - in: path + name: bundle + description: Name of the bundle + required: true + schema: *ref_0 + - in: path + name: type + description: Bundle type + required: true + schema: *ref_0 + - in: path + name: ext + description: Bundle extension + required: true + schema: *ref_0 + /automation/trigger: + post: + tags: + - Compose automation scripts + summary: Triggers execution of a specific script on a system service level + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_31 + script: + type: string + description: Script to execute + required: + - script + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_31 diff --git a/docs/compose/README.md b/docs/compose/README.md deleted file mode 100644 index 1ad88b539..000000000 --- a/docs/compose/README.md +++ /dev/null @@ -1,1178 +0,0 @@ -# Attachments - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/namespace/{namespaceID}/attachment/{kind}/` | List, filter all page attachments | -| `GET` | `/namespace/{namespaceID}/attachment/{kind}/{attachmentID}` | Attachment details | -| `DELETE` | `/namespace/{namespaceID}/attachment/{kind}/{attachmentID}` | Delete attachment | -| `GET` | `/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/original/{name}` | Serves attached file | -| `GET` | `/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/preview.{ext}` | Serves preview of an attached file | - -## List, filter all page attachments - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/attachment/{kind}/` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| pageID | uint64 | GET | Filter attachments by page ID | N/A | NO | -| moduleID | uint64 | GET | Filter attachments by module ID | N/A | NO | -| recordID | uint64 | GET | Filter attachments by record ID | N/A | NO | -| fieldName | string | GET | Filter attachments by field name | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | -| sign | string | GET | Signature | N/A | NO | -| userID | uint64 | GET | User ID | N/A | NO | -| kind | string | PATH | Attachment kind | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Attachment details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/attachment/{kind}/{attachmentID}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| attachmentID | uint64 | PATH | Attachment ID | N/A | YES | -| kind | string | PATH | Attachment kind | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| sign | string | GET | Signature | N/A | NO | -| userID | uint64 | GET | User ID | N/A | NO | - -## Delete attachment - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/attachment/{kind}/{attachmentID}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| attachmentID | uint64 | PATH | Attachment ID | N/A | YES | -| kind | string | PATH | Attachment kind | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| sign | string | GET | Signature | N/A | NO | -| userID | uint64 | GET | User ID | N/A | NO | - -## Serves attached file - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/original/{name}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| download | bool | GET | Force file download | N/A | NO | -| sign | string | GET | Signature | N/A | NO | -| userID | uint64 | GET | User ID | N/A | NO | -| attachmentID | uint64 | PATH | Attachment ID | N/A | YES | -| name | string | PATH | File name | N/A | YES | -| kind | string | PATH | Attachment kind | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Serves preview of an attached file - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/preview.{ext}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| attachmentID | uint64 | PATH | Attachment ID | N/A | YES | -| ext | string | PATH | Preview extension/format | N/A | YES | -| kind | string | PATH | Attachment kind | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| sign | string | GET | Signature | N/A | NO | -| userID | uint64 | GET | User ID | N/A | NO | - ---- - - - - -# Compose automation scripts - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/automation/` | List all available automation scripts for compose resources | -| `GET` | `/automation/{bundle}-{type}.{ext}` | Serves client scripts bundle | -| `POST` | `/automation/trigger` | Triggers execution of a specific script on a system service level | - -## List all available automation scripts for compose resources - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/automation/` | HTTP/S | GET | -Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32 - | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| resourceTypePrefixes | []string | GET | Filter by resource prefix | N/A | NO | -| resourceTypes | []string | GET | Filter by resource type | N/A | NO | -| eventTypes | []string | GET | Filter by event type | N/A | NO | -| excludeInvalid | bool | GET | Exclude scripts that can not be used (errors) | N/A | NO | -| excludeClientScripts | bool | GET | Do not include client scripts | N/A | NO | -| excludeServerScripts | bool | GET | Do not include server scripts | N/A | NO | - -## Serves client scripts bundle - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/automation/{bundle}-{type}.{ext}` | HTTP/S | GET | -Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32 - | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| bundle | string | PATH | Name of the bundle | N/A | NO | -| type | string | PATH | Bundle type | N/A | NO | -| ext | string | PATH | Bundle extension | N/A | NO | - -## Triggers execution of a specific script on a system service level - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/automation/trigger` | HTTP/S | POST | -Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32 - | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| script | string | POST | Script to execute | N/A | YES | - ---- - - - - -# Charts - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/namespace/{namespaceID}/chart/` | List/read charts | -| `POST` | `/namespace/{namespaceID}/chart/` | List/read charts | -| `GET` | `/namespace/{namespaceID}/chart/{chartID}` | Read charts by ID | -| `POST` | `/namespace/{namespaceID}/chart/{chartID}` | Add/update charts | -| `DELETE` | `/namespace/{namespaceID}/chart/{chartID}` | Delete chart | - -## List/read charts - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/chart/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| query | string | GET | Search query to match against charts | N/A | NO | -| handle | string | GET | Search charts by handle | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | -| sort | string | GET | Sort items | N/A | NO | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## List/read charts - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/chart/` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| config | sqlxTypes.JSONText | POST | Chart JSON | N/A | YES | -| name | string | POST | Chart name | N/A | YES | -| handle | string | POST | Chart handle | N/A | NO | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Read charts by ID - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/chart/{chartID}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| chartID | uint64 | PATH | Chart ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Add/update charts - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/chart/{chartID}` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| chartID | uint64 | PATH | Chart ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| config | sqlxTypes.JSONText | POST | Chart JSON | N/A | YES | -| name | string | POST | Chart name | N/A | YES | -| handle | string | POST | Chart handle | N/A | NO | -| updatedAt | *time.Time | POST | Last update (or creation) date | N/A | NO | - -## Delete chart - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/chart/{chartID}` | HTTP/S | DELETE | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| chartID | uint64 | PATH | Chart ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - ---- - - - - -# Modules - -Compose module definitions - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/namespace/{namespaceID}/module/` | List modules | -| `POST` | `/namespace/{namespaceID}/module/` | Create module | -| `GET` | `/namespace/{namespaceID}/module/{moduleID}` | Read module | -| `POST` | `/namespace/{namespaceID}/module/{moduleID}` | Update module | -| `DELETE` | `/namespace/{namespaceID}/module/{moduleID}` | Delete module | -| `POST` | `/namespace/{namespaceID}/module/{moduleID}/trigger` | Fire compose:module trigger | - -## List modules - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| query | string | GET | Search query | N/A | NO | -| name | string | GET | Search by name | N/A | NO | -| handle | string | GET | Search by handle | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | -| sort | string | GET | Sort items | N/A | NO | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Create module - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| name | string | POST | Module Name | N/A | YES | -| handle | string | POST | Module handle | N/A | NO | -| fields | types.ModuleFieldSet | POST | Fields JSON | N/A | YES | -| meta | sqlxTypes.JSONText | POST | Module meta data | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Read module - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| moduleID | uint64 | PATH | Module ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Update module - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| moduleID | uint64 | PATH | Module ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| name | string | POST | Module Name | N/A | YES | -| handle | string | POST | Module Handle | N/A | NO | -| fields | types.ModuleFieldSet | POST | Fields JSON | N/A | YES | -| meta | sqlxTypes.JSONText | POST | Module meta data | N/A | YES | -| updatedAt | *time.Time | POST | Last update (or creation) date | N/A | NO | - -## Delete module - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}` | HTTP/S | DELETE | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| moduleID | uint64 | PATH | Module ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Fire compose:module trigger - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/trigger` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| moduleID | uint64 | PATH | ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| script | string | POST | Script to execute | N/A | YES | - ---- - - - - -# Namespaces - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/namespace/` | List namespaces | -| `POST` | `/namespace/` | Create namespace | -| `GET` | `/namespace/{namespaceID}` | Read namespace | -| `POST` | `/namespace/{namespaceID}` | Update namespace | -| `DELETE` | `/namespace/{namespaceID}` | Delete namespace | -| `POST` | `/namespace/{namespaceID}/trigger` | Fire compose:namespace trigger | - -## List namespaces - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| query | string | GET | Search query | N/A | NO | -| slug | string | GET | Search by namespace slug | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | -| sort | string | GET | Sort items | N/A | NO | - -## Create namespace - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| name | string | POST | Name | N/A | YES | -| slug | string | POST | Slug (url path part) | N/A | NO | -| enabled | bool | POST | Enabled | N/A | NO | -| meta | sqlxTypes.JSONText | POST | Meta data | N/A | YES | - -## Read namespace - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| namespaceID | uint64 | PATH | ID | N/A | YES | - -## Update namespace - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| namespaceID | uint64 | PATH | ID | N/A | YES | -| name | string | POST | Name | N/A | YES | -| slug | string | POST | Slug (url path part) | N/A | NO | -| enabled | bool | POST | Enabled | N/A | NO | -| meta | sqlxTypes.JSONText | POST | Meta data | N/A | YES | -| updatedAt | *time.Time | POST | Last update (or creation) date | N/A | NO | - -## Delete namespace - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}` | HTTP/S | DELETE | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| namespaceID | uint64 | PATH | ID | N/A | YES | - -## Fire compose:namespace trigger - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/trigger` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| namespaceID | uint64 | PATH | ID | N/A | YES | -| script | string | POST | Script to execute | N/A | YES | - ---- - - - - -# Notifications - -Compose Notifications - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `POST` | `/notification/email` | Send email from the Compose | - -## Send email from the Compose - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/notification/email` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| to | []string | POST | Email addresses | N/A | YES | -| cc | []string | POST | Email addresses | N/A | NO | -| replyTo | string | POST | Email address in reply-to field | N/A | NO | -| subject | string | POST | Email subject | N/A | NO | -| content | sqlxTypes.JSONText | POST | Message content | N/A | YES | -| remoteAttachments | []string | POST | Remote files to attach to the email | N/A | NO | - ---- - - - - -# Pages - -Compose pages - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/namespace/{namespaceID}/page/` | List available pages | -| `POST` | `/namespace/{namespaceID}/page/` | Create page | -| `GET` | `/namespace/{namespaceID}/page/{pageID}` | Get page details | -| `GET` | `/namespace/{namespaceID}/page/tree` | Get page all (non-record) pages, hierarchically | -| `POST` | `/namespace/{namespaceID}/page/{pageID}` | Update page | -| `POST` | `/namespace/{namespaceID}/page/{selfID}/reorder` | Reorder pages | -| `Delete` | `/namespace/{namespaceID}/page/{pageID}` | Delete page | -| `POST` | `/namespace/{namespaceID}/page/{pageID}/attachment` | Uploads attachment to page | -| `POST` | `/namespace/{namespaceID}/page/{pageID}/trigger` | Fire compose:page trigger | - -## List available pages - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/page/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| selfID | uint64 | GET | Parent page ID | N/A | NO | -| query | string | GET | Search query | N/A | NO | -| handle | string | GET | Search by handle | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | -| sort | string | GET | Sort items | N/A | NO | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Create page - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/page/` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| selfID | uint64 | POST | Parent Page ID | N/A | NO | -| moduleID | uint64 | POST | Module ID | N/A | NO | -| title | string | POST | Title | N/A | YES | -| handle | string | POST | Handle | N/A | NO | -| description | string | POST | Description | N/A | NO | -| weight | int | POST | Page tree weight | N/A | NO | -| visible | bool | POST | Visible in navigation | N/A | NO | -| blocks | sqlxTypes.JSONText | POST | Blocks JSON | N/A | NO | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Get page details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/page/{pageID}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| pageID | uint64 | PATH | Page ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Get page all (non-record) pages, hierarchically - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/page/tree` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Update page - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/page/{pageID}` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| pageID | uint64 | PATH | Page ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| selfID | uint64 | POST | Parent Page ID | N/A | NO | -| moduleID | uint64 | POST | Module ID (optional) | N/A | NO | -| title | string | POST | Title | N/A | YES | -| handle | string | POST | Handle | N/A | NO | -| description | string | POST | Description | N/A | NO | -| weight | int | POST | Page tree weight | N/A | NO | -| visible | bool | POST | Visible in navigation | N/A | NO | -| blocks | sqlxTypes.JSONText | POST | Blocks JSON | N/A | NO | - -## Reorder pages - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/page/{selfID}/reorder` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| selfID | uint64 | PATH | Parent page ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| pageIDs | []string | POST | Page ID order | N/A | YES | - -## Delete page - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/page/{pageID}` | HTTP/S | Delete | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| pageID | uint64 | PATH | Page ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | - -## Uploads attachment to page - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/page/{pageID}/attachment` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| pageID | uint64 | PATH | Page ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| upload | *multipart.FileHeader | POST | File to upload | N/A | YES | - -## Fire compose:page trigger - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/page/{pageID}/trigger` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| pageID | uint64 | PATH | Page ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| script | string | POST | Script to execute | N/A | YES | - ---- - - - - -# Permissions - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/permissions/` | Retrieve defined permissions | -| `GET` | `/permissions/effective` | Effective rules for current user | -| `GET` | `/permissions/{roleID}/rules` | Retrieve role permissions | -| `DELETE` | `/permissions/{roleID}/rules` | Remove all defined role permissions | -| `PATCH` | `/permissions/{roleID}/rules` | Update permission settings | - -## Retrieve defined permissions - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - -## Effective rules for current user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/effective` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| resource | string | GET | Show only rules for a specific resource | N/A | NO | - -## Retrieve role permissions - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/{roleID}/rules` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Remove all defined role permissions - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/{roleID}/rules` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Update permission settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/{roleID}/rules` | HTTP/S | PATCH | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | -| rules | permissions.RuleSet | POST | List of permission rules to set | N/A | YES | - ---- - - - - -# Records - -Compose records - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/namespace/{namespaceID}/module/{moduleID}/record/report` | Generates report from module records | -| `GET` | `/namespace/{namespaceID}/module/{moduleID}/record/` | List/read records from module section | -| `POST` | `/namespace/{namespaceID}/module/{moduleID}/record/import` | Initiate record import session | -| `PATCH` | `/namespace/{namespaceID}/module/{moduleID}/record/import/{sessionID}` | Run record import | -| `GET` | `/namespace/{namespaceID}/module/{moduleID}/record/import/{sessionID}` | Get import progress | -| `GET` | `/namespace/{namespaceID}/module/{moduleID}/record/export{filename}.{ext}` | Exports records that match | -| `POST` | `/namespace/{namespaceID}/module/{moduleID}/record/exec/{procedure}` | Executes server-side procedure over one or more module records | -| `POST` | `/namespace/{namespaceID}/module/{moduleID}/record/` | Create record in module section | -| `GET` | `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}` | Read records by ID from module section | -| `POST` | `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}` | Update records in module section | -| `DELETE` | `/namespace/{namespaceID}/module/{moduleID}/record/` | Delete record row from module section | -| `DELETE` | `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}` | Delete record row from module section | -| `POST` | `/namespace/{namespaceID}/module/{moduleID}/record/attachment` | Uploads attachment and validates it against record field requirements | -| `POST` | `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}/trigger` | Fire compose:record trigger | -| `POST` | `/namespace/{namespaceID}/module/{moduleID}/record/trigger` | Fire compose:record trigger | - -## Generates report from module records - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/report` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| metrics | string | GET | Metrics (eg: 'SUM(money), MAX(calls)') | N/A | NO | -| dimensions | string | GET | Dimensions (eg: 'DATE(foo), status') | N/A | YES | -| filter | string | GET | Filter (eg: 'DATE(foo) > 2010') | N/A | NO | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - -## List/read records from module section - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| query | string | GET | Record filtering query | N/A | NO | -| filter | string | GET | Filtering condition (same as query, deprecated) | N/A | NO | -| deleted | uint | GET | Exclude (0, default), include (1) or return only (2) deleted records | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | -| sort | string | GET | Sort items | N/A | NO | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - -## Initiate record import session - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/import` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| upload | *multipart.FileHeader | POST | File import | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - -## Run record import - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/import/{sessionID}` | HTTP/S | PATCH | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| sessionID | uint64 | PATH | Import session | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | -| fields | json.RawMessage | POST | Fields defined by import file | N/A | YES | -| onError | string | POST | What happens if record fails to import | N/A | YES | - -## Get import progress - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/import/{sessionID}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| sessionID | uint64 | PATH | Import session | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - -## Exports records that match - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/export{filename}.{ext}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| filter | string | GET | Filtering condition | N/A | NO | -| fields | []string | GET | Fields to export | N/A | YES | -| timezone | string | GET | Convert times to this timezone | N/A | NO | -| filename | string | PATH | Filename to use | N/A | NO | -| ext | string | PATH | Export format | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - -## Executes server-side procedure over one or more module records - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/exec/{procedure}` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| procedure | string | PATH | Name of procedure to execute | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | -| args | []ProcedureArg | POST | Procedure arguments | N/A | NO | - -## Create record in module section - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| values | types.RecordValueSet | POST | Record values | N/A | NO | -| records | types.RecordBulkSet | POST | Records | N/A | NO | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - -## Read records by ID from module section - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| recordID | uint64 | PATH | Record ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - -## Update records in module section - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| recordID | uint64 | PATH | Record ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | -| values | types.RecordValueSet | POST | Record values | N/A | NO | -| records | types.RecordBulkSet | POST | Records | N/A | NO | - -## Delete record row from module section - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/` | HTTP/S | DELETE | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| recordIDs | []string | POST | IDs of records to delete | N/A | NO | -| truncate | bool | POST | Remove ALL records of a specified module (pending implementation) | N/A | NO | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - -## Delete record row from module section - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}` | HTTP/S | DELETE | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| recordID | uint64 | PATH | Record ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - -## Uploads attachment and validates it against record field requirements - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/attachment` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| recordID | uint64 | POST | Record ID | N/A | NO | -| fieldName | string | POST | Field name | N/A | YES | -| upload | *multipart.FileHeader | POST | File to upload | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - -## Fire compose:record trigger - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}/trigger` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| recordID | uint64 | PATH | ID | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | -| script | string | POST | Script to execute | N/A | YES | -| values | types.RecordValueSet | POST | Record values | N/A | YES | - -## Fire compose:record trigger - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/namespace/{namespaceID}/module/{moduleID}/record/trigger` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| script | string | POST | Script to execute | N/A | YES | -| namespaceID | uint64 | PATH | Namespace ID | N/A | YES | -| moduleID | uint64 | PATH | Module ID | N/A | YES | - ---- - - - - -# Settings - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/settings/` | List settings | -| `PATCH` | `/settings/` | Update settings | -| `GET` | `/settings/{key}` | Get a value for a key | -| `GET` | `/settings/current` | Current compose settings | - -## List settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| prefix | string | GET | Key prefix | N/A | NO | - -## Update settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/` | HTTP/S | PATCH | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| values | settings.ValueSet | POST | Array of new settings: `[{ name: ..., value: ... }]`. Omit value to remove setting | N/A | YES | - -## Get a value for a key - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/{key}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| ownerID | uint64 | GET | Owner ID | N/A | NO | -| key | string | PATH | Setting key | N/A | YES | - -## Current compose settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/current` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - ---- \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 000000000..2ee927d23 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,63 @@ + + + + + + Corteza Server REST API Documentation + + + + + + + +
+ + + + + + diff --git a/docs/messaging.yaml b/docs/messaging.yaml new file mode 100644 index 000000000..d348a320e --- /dev/null +++ b/docs/messaging.yaml @@ -0,0 +1,932 @@ +openapi: 3.0.0 +info: + title: Corteza messaging API + description: Corteza messaging REST API definition + version: 2020.9 + contact: + email: info@cortezaproject.org + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /commands/: + get: + tags: + - Commands + summary: List of available commands + responses: + '200': + description: OK + /status/: + get: + tags: + - Status + summary: See all current statuses + responses: + '200': + description: OK + post: + tags: + - Status + summary: Set user's status + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_0 + icon: + type: string + description: Status icon + message: + type: string + description: Status message + expires: + type: string + description: >- + Clear status when it expires (eg: when-active, afternoon, + tomorrow 1h, 30m, 1 PM, 2019-05-20) + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_0 + delete: + tags: + - Status + summary: Clear status + responses: + '200': + description: OK + /activity/: + post: + tags: + - User activity + summary: >- + Sends user's activity to all subscribers; globally or per + channel/message. + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_1 + channelID: + type: string + description: >- + Channel ID, if set, activity will be send only to subscribed + users + messageID: + type: string + description: 'Message ID, if set, channelID must be set as well' + kind: + type: string + description: Arbitrary string + required: + - kind + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_1 + /channels/: + get: + tags: + - Channels + summary: List channels + responses: + '200': + description: OK + parameters: + - in: query + name: query + description: Search query + required: false + schema: &ref_2 + type: string + post: + tags: + - Channels + summary: Create new channel + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_3 + name: + type: string + description: Name of Channel + topic: + type: string + description: Subject of Channel + type: + type: string + description: Channel type + membershipPolicy: + type: string + description: 'Membership policy (eg: featured, forced)?' + members: + type: array + items: *ref_2 + description: Initial members of the channel + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_3 + '/channels/{channelID}': + put: + tags: + - Channels + summary: Update channel details + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: &ref_5 + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_4 + name: + type: string + description: Name of Channel + topic: + type: string + description: Subject of Channel + membershipPolicy: + type: string + description: 'Membership policy (eg: featured, forced)?' + type: + type: string + description: Channel type + organisationID: + type: string + description: Move channel to different organisation + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_4 + get: + tags: + - Channels + summary: Read channel details + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + '/channels/{channelID}/state': + put: + tags: + - Channels + summary: Update channel state + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_6 + state: + type: string + description: 'Valid values: delete, undelete, archive, unarchive' + required: + - state + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_6 + '/channels/{channelID}/flag': + put: + tags: + - Channels + summary: Update channel membership flag + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_7 + flag: + type: string + description: 'Valid values: pinned, hidden, ignored' + required: + - flag + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_7 + delete: + tags: + - Channels + summary: Remove channel membership flag + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + '/channels/{channelID}/members': + get: + tags: + - Channels + summary: List channel members + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + '/channels/{channelID}/members/{userID}': + put: + tags: + - Channels + summary: Join channel + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: userID + description: Member ID + required: true + schema: *ref_5 + delete: + tags: + - Channels + summary: Remove member from channel + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: userID + description: Member ID + required: true + schema: *ref_5 + '/channels/{channelID}/invite': + post: + tags: + - Channels + summary: Join channel + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_8 + userID: + type: array + items: *ref_2 + description: User ID + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_8 + '/channels/{channelID}/attach': + post: + tags: + - Channels + summary: Attach file to channel + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_9 + replyTo: + type: string + description: Upload as a reply + upload: + type: string + format: binary + description: File to upload + required: + - upload + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_9 + '/channels/{channelID}/messages/': + post: + tags: + - Messages + summary: Post new message to the channel + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_10 + message: + type: string + description: Message contents (markdown) + required: + - message + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_10 + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + '/channels/{channelID}/messages/command/{command}/exec': + post: + tags: + - Messages + summary: Execute command + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: command + description: Command to be executed + required: true + schema: *ref_2 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_11 + input: + type: string + description: Arbitrary command input + params: + type: array + items: *ref_2 + description: Command parameters + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_11 + '/channels/{channelID}/messages/mark-as-read': + get: + tags: + - Messages + summary: Manages read/unread messages in a channel or a thread + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: query + name: threadID + description: 'ID of thread (messageID) ' + required: false + schema: *ref_5 + - in: query + name: lastReadMessageID + description: ID of the last read message + required: false + schema: *ref_5 + '/channels/{channelID}/messages/{messageID}': + put: + tags: + - Messages + summary: Edit existing message + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: messageID + description: Message ID + required: true + schema: *ref_5 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_12 + message: + type: string + description: Message contents (markdown) + required: + - message + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_12 + delete: + tags: + - Messages + summary: Delete existing message + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: messageID + description: Message ID + required: true + schema: *ref_5 + '/channels/{channelID}/messages/{messageID}/replies': + post: + tags: + - Messages + summary: Reply to a message + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: messageID + description: Message ID + required: true + schema: *ref_5 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_13 + message: + type: string + description: Message contents (markdown) + required: + - message + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_13 + '/channels/{channelID}/messages/{messageID}/pin': + post: + tags: + - Messages + summary: Pin message to channel (public bookmark) + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: messageID + description: Message ID + required: true + schema: *ref_5 + delete: + tags: + - Messages + summary: Pin message to channel (public bookmark) + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: messageID + description: Message ID + required: true + schema: *ref_5 + '/channels/{channelID}/messages/{messageID}/bookmark': + post: + tags: + - Messages + summary: Bookmark a message (private bookmark) + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: messageID + description: Message ID + required: true + schema: *ref_5 + delete: + tags: + - Messages + summary: Remove boomark from message (private bookmark) + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: messageID + description: Message ID + required: true + schema: *ref_5 + '/channels/{channelID}/messages/{messageID}/reaction/{reaction}': + post: + tags: + - Messages + summary: React to a message + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: messageID + description: Message ID + required: true + schema: *ref_5 + - in: path + name: reaction + description: Reaction + required: true + schema: *ref_2 + delete: + tags: + - Messages + summary: Delete reaction from a message + responses: + '200': + description: OK + parameters: + - in: path + name: channelID + description: Channel ID + required: true + schema: *ref_5 + - in: path + name: messageID + description: Message ID + required: true + schema: *ref_5 + - in: path + name: reaction + description: Reaction + required: true + schema: *ref_2 + '/attachment/{attachmentID}/original/{name}': + get: + tags: + - Attachments + summary: Serves attached file + responses: + '200': + description: OK + parameters: + - in: path + name: attachmentID + description: Attachment ID + required: true + schema: *ref_5 + - in: path + name: name + description: File name + required: true + schema: *ref_2 + - in: query + name: sign + description: Signature + required: true + schema: *ref_2 + - in: query + name: userID + description: User ID + required: true + schema: *ref_5 + - in: query + name: download + description: Force file download + required: false + schema: &ref_14 + type: boolean + '/attachment/{attachmentID}/preview.{ext}': + get: + tags: + - Attachments + summary: Serves preview of an attached file + responses: + '200': + description: OK + parameters: + - in: path + name: attachmentID + description: Attachment ID + required: true + schema: *ref_5 + - in: path + name: ext + description: Preview extension/format + required: true + schema: *ref_2 + - in: query + name: sign + description: Signature + required: true + schema: *ref_2 + - in: query + name: userID + description: User ID + required: true + schema: *ref_5 + /search/messages: + get: + tags: + - Search entry point + summary: Search for messages + responses: + '200': + description: OK + parameters: + - in: query + name: query + description: Search query + required: false + schema: *ref_2 + - in: query + name: channelID + description: Filter by channels + required: false + schema: + type: array + items: *ref_2 + - in: query + name: afterMessageID + description: ID of the first message in the list (exclusive) + required: false + schema: *ref_5 + - in: query + name: beforeMessageID + description: ID of the last message in the list (exclusive) + required: false + schema: *ref_5 + - in: query + name: fromMessageID + description: ID of the first message in the list (inclusive) + required: false + schema: *ref_5 + - in: query + name: toMessageID + description: ID of the last message the list (inclusive) + required: false + schema: *ref_5 + - in: query + name: threadID + description: Filter by thread message ID + required: false + schema: + type: array + items: *ref_2 + - in: query + name: userID + description: Filter by one or more user + required: false + schema: + type: array + items: *ref_2 + - in: query + name: type + description: 'Filter by message type (text, inlineImage, attachment, ...)' + required: false + schema: + type: array + items: *ref_2 + - in: query + name: pinnedOnly + description: Return only pinned messages + required: false + schema: *ref_14 + - in: query + name: bookmarkedOnly + description: Only bookmarked messages + required: false + schema: *ref_14 + - in: query + name: limit + description: Max number of messages + required: false + schema: &ref_15 + type: string + /search/threads: + get: + tags: + - Search entry point + summary: Search for threads + responses: + '200': + description: OK + parameters: + - in: query + name: query + description: Search query + required: false + schema: *ref_2 + - in: query + name: channelID + description: Filter by channels + required: false + schema: + type: array + items: *ref_2 + - in: query + name: limit + description: Max number of messages + required: false + schema: *ref_15 + /permissions/: + get: + tags: + - Permissions + summary: Retrieve defined permissions + responses: + '200': + description: OK + /permissions/effective: + get: + tags: + - Permissions + summary: Effective rules for current user + responses: + '200': + description: OK + parameters: + - in: query + name: resource + description: Show only rules for a specific resource + required: false + schema: *ref_2 + '/permissions/{roleID}/rules': + get: + tags: + - Permissions + summary: Retrieve role permissions + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_5 + delete: + tags: + - Permissions + summary: Remove all defined role permissions + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_5 + patch: + tags: + - Permissions + summary: Update permission settings + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_5 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_16 + rules: + type: array + items: + type: object + properties: + roleID: + type: string + format: uuid + resource: + type: string + operation: + type: string + access: + type: string + description: List of permission rules to set + required: + - rules + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_16 diff --git a/docs/messaging/README.md b/docs/messaging/README.md deleted file mode 100644 index 31f53b40f..000000000 --- a/docs/messaging/README.md +++ /dev/null @@ -1,774 +0,0 @@ -# User activity - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `POST` | `/activity/` | Sends user's activity to all subscribers; globally or per channel/message. | - -## Sends user's activity to all subscribers; globally or per channel/message. - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/activity/` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | POST | Channel ID, if set, activity will be send only to subscribed users | N/A | NO | -| messageID | uint64 | POST | Message ID, if set, channelID must be set as well | N/A | NO | -| kind | string | POST | Arbitrary string | N/A | YES | - ---- - - - - -# Attachments - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/attachment/{attachmentID}/original/{name}` | Serves attached file | -| `GET` | `/attachment/{attachmentID}/preview.{ext}` | Serves preview of an attached file | - -## Serves attached file - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/attachment/{attachmentID}/original/{name}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| download | bool | GET | Force file download | N/A | NO | -| sign | string | GET | Signature | N/A | YES | -| userID | uint64 | GET | User ID | N/A | YES | -| name | string | PATH | File name | N/A | YES | -| attachmentID | uint64 | PATH | Attachment ID | N/A | YES | - -## Serves preview of an attached file - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/attachment/{attachmentID}/preview.{ext}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| ext | string | PATH | Preview extension/format | N/A | YES | -| attachmentID | uint64 | PATH | Attachment ID | N/A | YES | -| sign | string | GET | Signature | N/A | YES | -| userID | uint64 | GET | User ID | N/A | YES | - ---- - - - - -# Channels - -A channel is a representation of a sequence of messages. It has meta data like channel subject. Channels may be public, private or group. - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/channels/` | List channels | -| `POST` | `/channels/` | Create new channel | -| `PUT` | `/channels/{channelID}` | Update channel details | -| `PUT` | `/channels/{channelID}/state` | Update channel state | -| `PUT` | `/channels/{channelID}/flag` | Update channel membership flag | -| `DELETE` | `/channels/{channelID}/flag` | Remove channel membership flag | -| `GET` | `/channels/{channelID}` | Read channel details | -| `GET` | `/channels/{channelID}/members` | List channel members | -| `PUT` | `/channels/{channelID}/members/{userID}` | Join channel | -| `DELETE` | `/channels/{channelID}/members/{userID}` | Remove member from channel | -| `POST` | `/channels/{channelID}/invite` | Join channel | -| `POST` | `/channels/{channelID}/attach` | Attach file to channel | - -## List channels - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| query | string | GET | Search query | N/A | NO | - -## Create new channel - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| name | string | POST | Name of Channel | N/A | NO | -| topic | string | POST | Subject of Channel | N/A | NO | -| type | string | POST | Channel type | N/A | NO | -| membershipPolicy | types.ChannelMembershipPolicy | POST | Membership policy (eg: featured, forced)? | N/A | NO | -| members | []string | POST | Initial members of the channel | N/A | NO | - -## Update channel details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}` | HTTP/S | PUT | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | PATH | Channel ID | N/A | YES | -| name | string | POST | Name of Channel | N/A | NO | -| topic | string | POST | Subject of Channel | N/A | NO | -| membershipPolicy | types.ChannelMembershipPolicy | POST | Membership policy (eg: featured, forced)? | N/A | NO | -| type | string | POST | Channel type | N/A | NO | -| organisationID | uint64 | POST | Move channel to different organisation | N/A | NO | - -## Update channel state - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/state` | HTTP/S | PUT | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | PATH | Channel ID | N/A | YES | -| state | string | POST | Valid values: delete, undelete, archive, unarchive | N/A | YES | - -## Update channel membership flag - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/flag` | HTTP/S | PUT | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | PATH | Channel ID | N/A | YES | -| flag | string | POST | Valid values: pinned, hidden, ignored | N/A | YES | - -## Remove channel membership flag - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/flag` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## Read channel details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## List channel members - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/members` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## Join channel - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/members/{userID}` | HTTP/S | PUT | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | PATH | Channel ID | N/A | YES | -| userID | uint64 | PATH | Member ID | N/A | NO | - -## Remove member from channel - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/members/{userID}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | PATH | Channel ID | N/A | YES | -| userID | uint64 | PATH | Member ID | N/A | NO | - -## Join channel - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/invite` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | PATH | Channel ID | N/A | YES | -| userID | []string | POST | User ID | N/A | NO | - -## Attach file to channel - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/attach` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | uint64 | PATH | Channel ID | N/A | YES | -| replyTo | uint64 | POST | Upload as a reply | N/A | NO | -| upload | *multipart.FileHeader | POST | File to upload | N/A | YES | - ---- - - - - -# Commands - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/commands/` | List of available commands | - -## List of available commands - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/commands/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - ---- - - - - -# Messages - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `POST` | `/channels/{channelID}/messages/` | Post new message to the channel | -| `POST` | `/channels/{channelID}/messages/command/{command}/exec` | Execute command | -| `GET` | `/channels/{channelID}/messages/mark-as-read` | Manages read/unread messages in a channel or a thread | -| `PUT` | `/channels/{channelID}/messages/{messageID}` | Edit existing message | -| `DELETE` | `/channels/{channelID}/messages/{messageID}` | Delete existing message | -| `POST` | `/channels/{channelID}/messages/{messageID}/replies` | Reply to a message | -| `POST` | `/channels/{channelID}/messages/{messageID}/pin` | Pin message to channel (public bookmark) | -| `DELETE` | `/channels/{channelID}/messages/{messageID}/pin` | Pin message to channel (public bookmark) | -| `POST` | `/channels/{channelID}/messages/{messageID}/bookmark` | Bookmark a message (private bookmark) | -| `DELETE` | `/channels/{channelID}/messages/{messageID}/bookmark` | Remove boomark from message (private bookmark) | -| `POST` | `/channels/{channelID}/messages/{messageID}/reaction/{reaction}` | React to a message | -| `DELETE` | `/channels/{channelID}/messages/{messageID}/reaction/{reaction}` | Delete reaction from a message | - -## Post new message to the channel - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| message | string | POST | Message contents (markdown) | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## Execute command - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/command/{command}/exec` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| command | string | PATH | Command to be executed | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | -| input | string | POST | Arbitrary command input | N/A | NO | -| params | []string | POST | Command parameters | N/A | NO | - -## Manages read/unread messages in a channel or a thread - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/mark-as-read` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| threadID | uint64 | GET | ID of thread (messageID) | N/A | NO | -| lastReadMessageID | uint64 | GET | ID of the last read message | N/A | NO | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## Edit existing message - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/{messageID}` | HTTP/S | PUT | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| messageID | uint64 | PATH | Message ID | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | -| message | string | POST | Message contents (markdown) | N/A | YES | - -## Delete existing message - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/{messageID}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| messageID | uint64 | PATH | Message ID | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## Reply to a message - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/{messageID}/replies` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| messageID | uint64 | PATH | Message ID | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | -| message | string | POST | Message contents (markdown) | N/A | YES | - -## Pin message to channel (public bookmark) - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/{messageID}/pin` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| messageID | uint64 | PATH | Message ID | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## Pin message to channel (public bookmark) - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/{messageID}/pin` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| messageID | uint64 | PATH | Message ID | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## Bookmark a message (private bookmark) - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/{messageID}/bookmark` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| messageID | uint64 | PATH | Message ID | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## Remove boomark from message (private bookmark) - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/{messageID}/bookmark` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| messageID | uint64 | PATH | Message ID | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## React to a message - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/{messageID}/reaction/{reaction}` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| messageID | uint64 | PATH | Message ID | N/A | YES | -| reaction | string | PATH | Reaction | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - -## Delete reaction from a message - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/channels/{channelID}/messages/{messageID}/reaction/{reaction}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| messageID | uint64 | PATH | Message ID | N/A | YES | -| reaction | string | PATH | Reaction | N/A | YES | -| channelID | uint64 | PATH | Channel ID | N/A | YES | - ---- - - - - -# Permissions - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/permissions/` | Retrieve defined permissions | -| `GET` | `/permissions/effective` | Effective rules for current user | -| `GET` | `/permissions/{roleID}/rules` | Retrieve role permissions | -| `DELETE` | `/permissions/{roleID}/rules` | Remove all defined role permissions | -| `PATCH` | `/permissions/{roleID}/rules` | Update permission settings | - -## Retrieve defined permissions - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - -## Effective rules for current user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/effective` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| resource | string | GET | Show only rules for a specific resource | N/A | NO | - -## Retrieve role permissions - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/{roleID}/rules` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Remove all defined role permissions - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/{roleID}/rules` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Update permission settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/{roleID}/rules` | HTTP/S | PATCH | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | -| rules | permissions.RuleSet | POST | List of permission rules to set | N/A | YES | - ---- - - - - -# Search entry point - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/search/messages` | Search for messages | -| `GET` | `/search/threads` | Search for threads | - -## Search for messages - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/search/messages` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | []string | GET | Filter by channels | N/A | NO | -| afterMessageID | uint64 | GET | ID of the first message in the list (exclusive) | N/A | NO | -| beforeMessageID | uint64 | GET | ID of the last message in the list (exclusive) | N/A | NO | -| fromMessageID | uint64 | GET | ID of the first message in the list (inclusive) | N/A | NO | -| toMessageID | uint64 | GET | ID of the last message the list (inclusive) | N/A | NO | -| threadID | []string | GET | Filter by thread message ID | N/A | NO | -| userID | []string | GET | Filter by one or more user | N/A | NO | -| type | []string | GET | Filter by message type (text, inlineImage, attachment, ...) | N/A | NO | -| pinnedOnly | bool | GET | Return only pinned messages | N/A | NO | -| bookmarkedOnly | bool | GET | Only bookmarked messages | N/A | NO | -| limit | uint | GET | Max number of messages | N/A | NO | -| query | string | GET | Search query | N/A | NO | - -## Search for threads - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/search/threads` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| channelID | []string | GET | Filter by channels | N/A | NO | -| limit | uint | GET | Max number of messages | N/A | NO | -| query | string | GET | Search query | N/A | NO | - ---- - - - - -# Settings - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/settings/` | List settings | -| `PATCH` | `/settings/` | Update settings | -| `GET` | `/settings/{key}` | Get a value for a key | -| `GET` | `/settings/current` | Current compose settings | - -## List settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| prefix | string | GET | Key prefix | N/A | NO | - -## Update settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/` | HTTP/S | PATCH | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| values | settings.ValueSet | POST | Array of new settings: `[{ name: ..., value: ... }]`. Omit value to remove setting | N/A | YES | - -## Get a value for a key - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/{key}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| ownerID | uint64 | GET | Owner ID | N/A | NO | -| key | string | PATH | Setting key | N/A | YES | - -## Current compose settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/current` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - ---- - - - - -# Status - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/status/` | See all current statuses | -| `POST` | `/status/` | Set user's status | -| `DELETE` | `/status/` | Clear status | - -## See all current statuses - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/status/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - -## Set user's status - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/status/` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| icon | string | POST | Status icon | N/A | NO | -| message | string | POST | Status message | N/A | NO | -| expires | string | POST | Clear status when it expires (eg: when-active, afternoon, tomorrow 1h, 30m, 1 PM, 2019-05-20) | N/A | NO | - -## Clear status - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/status/` | HTTP/S | DELETE | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - ---- \ No newline at end of file diff --git a/docs/static.go b/docs/static.go new file mode 100644 index 000000000..acbf0f80a --- /dev/null +++ b/docs/static.go @@ -0,0 +1,6 @@ +// Code generated by statik. DO NOT EDIT. + +// Package contains static assets. +package docs + +var Asset = "PK\x03\x04\x14\x00\x08\x00\x00\x00\x00\x00!(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b\x00 \x00README.adocUT\x05\x00\x01\x80Cm8# Corteza API documentation\n\nWARNING: Work in progress\n\nThis is the first step in migration towards full OpenAPI standards support.`\n\n## Original/starting state (pre `2020.9`; deprecated):\nHome-brew API definition format in JSON, still available under `api/*/spec.json`.\nThis is still needed for controller/request/handler codegens. Documentation generators are disabled.\n\n## Current state (`2020.9`)\nIn branch `2020.12.x` we're experimenting with first step toward conversion to OpenAPI 3.0 YAML files for API\ndefinition. There is a converter available in https://github.com/cortezaproject/openapi3-converter[cortezaproject/openapi3-converter]\nthat takes those custom YAML files and converts them to OpenAPI format.\n\n## Goal (target `2020.12`)\nGenerate HTTP handlers and all auxilary code and documentation from YAML files in OpenAPI 3.0 format\nPK\x07\x08$jr\x0dN\x03\x00\x00N\x03\x00\x00PK\x03\x04\x14\x00\x08\x00\x00\x00\x00\x00!(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00 \x00compose.yamlUT\x05\x00\x01\x80Cm8openapi: 3.0.0\ninfo:\n title: Corteza compose API\n description: Corteza compose REST API definition\n version: 2020.9\n contact:\n email: info@cortezaproject.org\n license:\n name: Apache 2.0\n url: 'http://www.apache.org/licenses/LICENSE-2.0.html'\npaths:\n /namespace/:\n get:\n tags:\n - Namespaces\n summary: List namespaces\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: query\n description: Search query\n required: false\n schema: &ref_0\n type: string\n - in: query\n name: slug\n description: Search by namespace slug\n required: false\n schema: *ref_0\n - in: query\n name: limit\n description: Limit\n required: false\n schema: &ref_5\n type: string\n - in: query\n name: pageCursor\n description: Page cursor\n required: false\n schema: *ref_0\n - in: query\n name: sort\n description: Sort items\n required: false\n schema: *ref_0\n post:\n tags:\n - Namespaces\n summary: Create namespace\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_1\n name:\n type: string\n description: Name\n slug:\n type: string\n description: Slug (url path part)\n enabled:\n type: boolean\n description: Enabled\n meta:\n type: string\n format: json\n description: Meta data\n required:\n - name\n - meta\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_1\n '/namespace/{namespaceID}':\n get:\n tags:\n - Namespaces\n summary: Read namespace\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: ID\n required: true\n schema: &ref_2\n type: string\n post:\n tags:\n - Namespaces\n summary: Update namespace\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_3\n name:\n type: string\n description: Name\n slug:\n type: string\n description: Slug (url path part)\n enabled:\n type: boolean\n description: Enabled\n meta:\n type: string\n format: json\n description: Meta data\n updatedAt:\n type: string\n format: date-time\n description: Last update (or creation) date\n required:\n - name\n - meta\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_3\n delete:\n tags:\n - Namespaces\n summary: Delete namespace\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/trigger':\n post:\n tags:\n - Namespaces\n summary: 'Fire compose:namespace trigger'\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_4\n script:\n type: string\n description: Script to execute\n required:\n - script\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_4\n '/namespace/{namespaceID}/page/':\n get:\n tags:\n - Pages\n summary: List available pages\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: selfID\n description: Parent page ID\n required: false\n schema: *ref_2\n - in: query\n name: query\n description: Search query\n required: false\n schema: *ref_0\n - in: query\n name: handle\n description: Search by handle\n required: false\n schema: *ref_0\n - in: query\n name: limit\n description: Limit\n required: false\n schema: *ref_5\n - in: query\n name: pageCursor\n description: Page cursor\n required: false\n schema: *ref_0\n - in: query\n name: sort\n description: Sort items\n required: false\n schema: *ref_0\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n post:\n tags:\n - Pages\n summary: Create page\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_6\n selfID:\n type: string\n description: Parent Page ID\n moduleID:\n type: string\n description: Module ID\n title:\n type: string\n description: Title\n handle:\n type: string\n description: Handle\n description:\n type: string\n description: Description\n weight:\n type: integer\n description: Page tree weight\n visible:\n type: boolean\n description: Visible in navigation\n blocks:\n type: string\n format: json\n description: Blocks JSON\n required:\n - title\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_6\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/page/{pageID}':\n get:\n tags:\n - Pages\n summary: Get page details\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: pageID\n description: Page ID\n required: true\n schema: *ref_2\n post:\n tags:\n - Pages\n summary: Update page\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: pageID\n description: Page ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_7\n selfID:\n type: string\n description: Parent Page ID\n moduleID:\n type: string\n description: Module ID (optional)\n title:\n type: string\n description: Title\n handle:\n type: string\n description: Handle\n description:\n type: string\n description: Description\n weight:\n type: integer\n description: Page tree weight\n visible:\n type: boolean\n description: Visible in navigation\n blocks:\n type: string\n format: json\n description: Blocks JSON\n required:\n - title\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_7\n delete:\n tags:\n - Pages\n summary: Delete page\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: pageID\n description: Page ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/page/tree':\n get:\n tags:\n - Pages\n summary: 'Get page all (non-record) pages, hierarchically'\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/page/{selfID}/reorder':\n post:\n tags:\n - Pages\n summary: Reorder pages\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: selfID\n description: Parent page ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_8\n pageIDs:\n type: array\n items: *ref_0\n description: Page ID order\n required:\n - pageIDs\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_8\n '/namespace/{namespaceID}/page/{pageID}/attachment':\n post:\n tags:\n - Pages\n summary: Uploads attachment to page\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: pageID\n description: Page ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_9\n upload:\n type: string\n format: binary\n description: File to upload\n required:\n - upload\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_9\n '/namespace/{namespaceID}/page/{pageID}/trigger':\n post:\n tags:\n - Pages\n summary: 'Fire compose:page trigger'\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: pageID\n description: Page ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_10\n script:\n type: string\n description: Script to execute\n required:\n - script\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_10\n '/namespace/{namespaceID}/module/':\n get:\n tags:\n - Modules\n summary: List modules\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: query\n description: Search query\n required: false\n schema: *ref_0\n - in: query\n name: name\n description: Search by name\n required: false\n schema: *ref_0\n - in: query\n name: handle\n description: Search by handle\n required: false\n schema: *ref_0\n - in: query\n name: limit\n description: Limit\n required: false\n schema: *ref_5\n - in: query\n name: pageCursor\n description: Page cursor\n required: false\n schema: *ref_0\n - in: query\n name: sort\n description: Sort items\n required: false\n schema: *ref_0\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n post:\n tags:\n - Modules\n summary: Create module\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_11\n name:\n type: string\n description: Module Name\n handle:\n type: string\n description: Module handle\n fields:\n type: array\n items: &ref_12\n type: object\n properties:\n fieldID:\n type: string\n format: uuid\n name:\n type: string\n kind:\n type: string\n label:\n type: string\n defaultValue:\n type: array\n items:\n type: string\n maxLength:\n type: integer\n isRequired:\n type: boolean\n isPrivate:\n type: boolean\n isMulti:\n type: boolean\n isSystem:\n type: boolean\n options:\n type: object\n description: Fields JSON\n meta:\n type: string\n format: json\n description: Module meta data\n required:\n - name\n - fields\n - meta\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_11\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/module/{moduleID}':\n get:\n tags:\n - Modules\n summary: Read module\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n post:\n tags:\n - Modules\n summary: Update module\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_13\n name:\n type: string\n description: Module Name\n handle:\n type: string\n description: Module Handle\n fields:\n type: array\n items: *ref_12\n description: Fields JSON\n meta:\n type: string\n format: json\n description: Module meta data\n updatedAt:\n type: string\n format: date-time\n description: Last update (or creation) date\n required:\n - name\n - fields\n - meta\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_13\n delete:\n tags:\n - Modules\n summary: Delete module\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/module/{moduleID}/trigger':\n post:\n tags:\n - Modules\n summary: 'Fire compose:module trigger'\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_14\n script:\n type: string\n description: Script to execute\n required:\n - script\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_14\n '/namespace/{namespaceID}/module/{moduleID}/record/report':\n get:\n tags:\n - Records\n summary: Generates report from module records\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: metrics\n description: 'Metrics (eg: ''SUM(money), MAX(calls)'')'\n required: false\n schema: *ref_0\n - in: query\n name: dimensions\n description: 'Dimensions (eg: ''DATE(foo), status'')'\n required: true\n schema: *ref_0\n - in: query\n name: filter\n description: 'Filter (eg: ''DATE(foo) > 2010'')'\n required: false\n schema: *ref_0\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/module/{moduleID}/record/':\n get:\n tags:\n - Records\n summary: List/read records from module section\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: query\n description: Record filtering query\n required: false\n schema: *ref_0\n - in: query\n name: filter\n description: 'Filtering condition (same as query, deprecated)'\n required: false\n schema: *ref_0\n - in: query\n name: deleted\n description: 'Exclude (0, default), include (1) or return only (2) deleted records'\n required: false\n schema: *ref_5\n - in: query\n name: limit\n description: Limit\n required: false\n schema: *ref_5\n - in: query\n name: offset\n description: Offset\n required: false\n schema: *ref_5\n - in: query\n name: page\n description: Page number (1-based)\n required: false\n schema: *ref_5\n - in: query\n name: perPage\n description: Returned items per page (default 50)\n required: false\n schema: *ref_5\n - in: query\n name: sort\n description: Sort items\n required: false\n schema: *ref_0\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n post:\n tags:\n - Records\n summary: Create record in module section\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_15\n values:\n type: array\n items: &ref_20\n type: object\n properties:\n name:\n type: string\n value:\n type: string\n description: Record values\n records:\n type: array\n items: &ref_21\n type: object\n properties:\n recordID:\n type: string\n format: uuid\n moduleID:\n type: string\n format: uuid\n namespaceID:\n type: string\n format: uuid\n values:\n type: array\n items:\n type: object\n properties:\n name:\n type: string\n value:\n type: string\n createdAt:\n type: string\n format: date-time\n updatedAt:\n type: string\n format: date-time\n deletedAt:\n type: string\n format: date-time\n ownedBy:\n type: string\n format: uuid\n createdBy:\n type: string\n format: uuid\n updatedBy:\n type: string\n format: uuid\n deletedBy:\n type: string\n format: uuid\n description: Records\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_15\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n delete:\n tags:\n - Records\n summary: Delete record row from module section\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_16\n recordIDs:\n type: array\n items: *ref_0\n description: IDs of records to delete\n truncate:\n type: boolean\n description: >-\n Remove ALL records of a specified module (pending\n implementation)\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_16\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/module/{moduleID}/record/import':\n post:\n tags:\n - Records\n summary: Initiate record import session\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_17\n upload:\n type: string\n format: binary\n description: File import\n required:\n - upload\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_17\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/module/{moduleID}/record/import/{sessionID}':\n patch:\n tags:\n - Records\n summary: Run record import\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n - in: path\n name: sessionID\n description: Import session\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_18\n fields:\n type: string\n format: json\n description: Fields defined by import file\n onError:\n type: string\n description: What happens if record fails to import\n required:\n - fields\n - onError\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_18\n get:\n tags:\n - Records\n summary: Get import progress\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n - in: path\n name: sessionID\n description: Import session\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/module/{moduleID}/record/export{filename}.{ext}':\n get:\n tags:\n - Records\n summary: 'Exports records that match '\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n - in: path\n name: filename\n description: Filename to use\n required: true\n schema: *ref_0\n - in: path\n name: ext\n description: Export format\n required: true\n schema: *ref_0\n - in: query\n name: filter\n description: Filtering condition\n required: false\n schema: *ref_0\n - in: query\n name: fields\n description: Fields to export\n required: true\n schema:\n type: array\n items: *ref_0\n - in: query\n name: timezone\n description: Convert times to this timezone\n required: false\n schema: *ref_0\n '/namespace/{namespaceID}/module/{moduleID}/record/exec/{procedure}':\n post:\n tags:\n - Records\n summary: Executes server-side procedure over one or more module records\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n - in: path\n name: procedure\n description: Name of procedure to execute\n required: true\n schema: *ref_0\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_19\n args:\n type: array\n items:\n type: object\n properties:\n name:\n type: string\n value:\n type: string\n description: Procedure arguments\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_19\n '/namespace/{namespaceID}/module/{moduleID}/record/{recordID}':\n get:\n tags:\n - Records\n summary: Read records by ID from module section\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n - in: path\n name: recordID\n description: Record ID\n required: true\n schema: *ref_2\n post:\n tags:\n - Records\n summary: Update records in module section\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n - in: path\n name: recordID\n description: Record ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_22\n values:\n type: array\n items: *ref_20\n description: Record values\n records:\n type: array\n items: *ref_21\n description: Records\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_22\n delete:\n tags:\n - Records\n summary: Delete record row from module section\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n - in: path\n name: recordID\n description: Record ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/module/{moduleID}/record/attachment':\n post:\n tags:\n - Records\n summary: Uploads attachment and validates it against record field requirements\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_23\n recordID:\n type: string\n description: Record ID\n fieldName:\n type: string\n description: Field name\n upload:\n type: string\n format: binary\n description: File to upload\n required:\n - fieldName\n - upload\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_23\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/module/{moduleID}/record/{recordID}/trigger':\n post:\n tags:\n - Records\n summary: 'Fire compose:record trigger'\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n - in: path\n name: recordID\n description: ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_24\n script:\n type: string\n description: Script to execute\n values:\n type: array\n items: *ref_20\n description: Record values\n required:\n - script\n - values\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_24\n '/namespace/{namespaceID}/module/{moduleID}/record/trigger':\n post:\n tags:\n - Records\n summary: 'Fire compose:record trigger'\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_25\n script:\n type: string\n description: Script to execute\n required:\n - script\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_25\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: moduleID\n description: Module ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/chart/':\n get:\n tags:\n - Charts\n summary: List/read charts\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: query\n description: Search query to match against charts\n required: false\n schema: *ref_0\n - in: query\n name: handle\n description: Search charts by handle\n required: false\n schema: *ref_0\n - in: query\n name: limit\n description: Limit\n required: false\n schema: *ref_5\n - in: query\n name: pageCursor\n description: Page cursor\n required: false\n schema: *ref_0\n - in: query\n name: sort\n description: Sort items\n required: false\n schema: *ref_0\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n post:\n tags:\n - Charts\n summary: 'List/read charts '\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_26\n config:\n type: string\n format: json\n description: Chart JSON\n name:\n type: string\n description: Chart name\n handle:\n type: string\n description: Chart handle\n required:\n - config\n - name\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_26\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/chart/{chartID}':\n get:\n tags:\n - Charts\n summary: Read charts by ID\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: chartID\n description: Chart ID\n required: true\n schema: *ref_2\n post:\n tags:\n - Charts\n summary: Add/update charts\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: chartID\n description: Chart ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_27\n config:\n type: string\n format: json\n description: Chart JSON\n name:\n type: string\n description: Chart name\n handle:\n type: string\n description: Chart handle\n updatedAt:\n type: string\n format: date-time\n description: Last update (or creation) date\n required:\n - config\n - name\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_27\n delete:\n tags:\n - Charts\n summary: Delete chart\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: chartID\n description: Chart ID\n required: true\n schema: *ref_2\n /notification/email:\n post:\n tags:\n - Notifications\n summary: Send email from the Compose\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_28\n to:\n type: array\n items: *ref_0\n description: Email addresses\n cc:\n type: array\n items: *ref_0\n description: Email addresses\n replyTo:\n type: string\n description: Email address in reply-to field\n subject:\n type: string\n description: Email subject\n content:\n type: string\n format: json\n description: Message content\n remoteAttachments:\n type: array\n items: *ref_0\n description: Remote files to attach to the email\n required:\n - to\n - content\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_28\n '/namespace/{namespaceID}/attachment/{kind}/':\n get:\n tags:\n - Attachments\n summary: 'List, filter all page attachments'\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: sign\n description: Signature\n required: false\n schema: *ref_0\n - in: query\n name: userID\n description: User ID\n required: false\n schema: *ref_2\n - in: query\n name: pageID\n description: Filter attachments by page ID\n required: false\n schema: *ref_2\n - in: query\n name: moduleID\n description: Filter attachments by module ID\n required: false\n schema: *ref_2\n - in: query\n name: recordID\n description: Filter attachments by record ID\n required: false\n schema: *ref_2\n - in: query\n name: fieldName\n description: Filter attachments by field name\n required: false\n schema: *ref_0\n - in: query\n name: limit\n description: Limit\n required: false\n schema: *ref_5\n - in: query\n name: offset\n description: Offset\n required: false\n schema: *ref_5\n - in: query\n name: page\n description: Page number (1-based)\n required: false\n schema: *ref_5\n - in: query\n name: perPage\n description: Returned items per page (default 50)\n required: false\n schema: *ref_5\n - in: path\n name: kind\n description: Attachment kind\n required: true\n schema: *ref_0\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n '/namespace/{namespaceID}/attachment/{kind}/{attachmentID}':\n get:\n tags:\n - Attachments\n summary: Attachment details\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: kind\n description: Attachment kind\n required: true\n schema: *ref_0\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: attachmentID\n description: Attachment ID\n required: true\n schema: *ref_2\n - in: query\n name: sign\n description: Signature\n required: false\n schema: *ref_0\n - in: query\n name: userID\n description: User ID\n required: false\n schema: *ref_2\n delete:\n tags:\n - Attachments\n summary: Delete attachment\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: kind\n description: Attachment kind\n required: true\n schema: *ref_0\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: attachmentID\n description: Attachment ID\n required: true\n schema: *ref_2\n - in: query\n name: sign\n description: Signature\n required: false\n schema: *ref_0\n - in: query\n name: userID\n description: User ID\n required: false\n schema: *ref_2\n '/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/original/{name}':\n get:\n tags:\n - Attachments\n summary: Serves attached file\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: kind\n description: Attachment kind\n required: true\n schema: *ref_0\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: attachmentID\n description: Attachment ID\n required: true\n schema: *ref_2\n - in: path\n name: name\n description: File name\n required: true\n schema: *ref_0\n - in: query\n name: sign\n description: Signature\n required: false\n schema: *ref_0\n - in: query\n name: userID\n description: User ID\n required: false\n schema: *ref_2\n - in: query\n name: download\n description: Force file download\n required: false\n schema: &ref_30\n type: boolean\n '/namespace/{namespaceID}/attachment/{kind}/{attachmentID}/preview.{ext}':\n get:\n tags:\n - Attachments\n summary: Serves preview of an attached file\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: kind\n description: Attachment kind\n required: true\n schema: *ref_0\n - in: path\n name: namespaceID\n description: Namespace ID\n required: true\n schema: *ref_2\n - in: path\n name: attachmentID\n description: Attachment ID\n required: true\n schema: *ref_2\n - in: path\n name: ext\n description: Preview extension/format\n required: true\n schema: *ref_0\n - in: query\n name: sign\n description: Signature\n required: false\n schema: *ref_0\n - in: query\n name: userID\n description: User ID\n required: false\n schema: *ref_2\n /permissions/:\n get:\n tags:\n - Permissions\n summary: Retrieve defined permissions\n responses:\n '200':\n description: OK\n /permissions/effective:\n get:\n tags:\n - Permissions\n summary: Effective rules for current user\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: resource\n description: Show only rules for a specific resource\n required: false\n schema: *ref_0\n '/permissions/{roleID}/rules':\n get:\n tags:\n - Permissions\n summary: Retrieve role permissions\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_2\n delete:\n tags:\n - Permissions\n summary: Remove all defined role permissions\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_2\n patch:\n tags:\n - Permissions\n summary: Update permission settings\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_29\n rules:\n type: array\n items:\n type: object\n properties:\n roleID:\n type: string\n format: uuid\n resource:\n type: string\n operation:\n type: string\n access:\n type: string\n description: List of permission rules to set\n required:\n - rules\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_29\n /automation/:\n get:\n tags:\n - Compose automation scripts\n summary: List all available automation scripts for compose resources\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: resourceTypePrefixes\n description: Filter by resource prefix\n required: false\n schema:\n type: array\n items: *ref_0\n - in: query\n name: resourceTypes\n description: Filter by resource type\n required: false\n schema:\n type: array\n items: *ref_0\n - in: query\n name: eventTypes\n description: Filter by event type\n required: false\n schema:\n type: array\n items: *ref_0\n - in: query\n name: excludeInvalid\n description: Exclude scripts that can not be used (errors)\n required: false\n schema: *ref_30\n - in: query\n name: excludeClientScripts\n description: Do not include client scripts\n required: false\n schema: *ref_30\n - in: query\n name: excludeServerScripts\n description: Do not include server scripts\n required: false\n schema: *ref_30\n '/automation/{bundle}-{type}.{ext}':\n get:\n tags:\n - Compose automation scripts\n summary: Serves client scripts bundle\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: bundle\n description: Name of the bundle\n required: true\n schema: *ref_0\n - in: path\n name: type\n description: Bundle type\n required: true\n schema: *ref_0\n - in: path\n name: ext\n description: Bundle extension\n required: true\n schema: *ref_0\n /automation/trigger:\n post:\n tags:\n - Compose automation scripts\n summary: Triggers execution of a specific script on a system service level\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_31\n script:\n type: string\n description: Script to execute\n required:\n - script\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_31\nPK\x07\x08\xf4\xc4\xa2\x1d\xdb\xc9\x00\x00\xdb\xc9\x00\x00PK\x03\x04\x14\x00\x08\x00\x00\x00\x00\x00!(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00 \x00index.htmlUT\x05\x00\x01\x80Cm8\n\n\n \n \n Corteza Server REST API Documentation\n \n \n \n \n \n\n \n
\n \n \n\n \n \n\nPK\x07\x08;\xaaT,B\x07\x00\x00B\x07\x00\x00PK\x03\x04\x14\x00\x08\x00\x00\x00\x00\x00!(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x00 \x00messaging.yamlUT\x05\x00\x01\x80Cm8openapi: 3.0.0\ninfo:\n title: Corteza messaging API\n description: Corteza messaging REST API definition\n version: 2020.9\n contact:\n email: info@cortezaproject.org\n license:\n name: Apache 2.0\n url: 'http://www.apache.org/licenses/LICENSE-2.0.html'\npaths:\n /commands/:\n get:\n tags:\n - Commands\n summary: List of available commands\n responses:\n '200':\n description: OK\n /status/:\n get:\n tags:\n - Status\n summary: See all current statuses\n responses:\n '200':\n description: OK\n post:\n tags:\n - Status\n summary: Set user's status\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_0\n icon:\n type: string\n description: Status icon\n message:\n type: string\n description: Status message\n expires:\n type: string\n description: >-\n Clear status when it expires (eg: when-active, afternoon,\n tomorrow 1h, 30m, 1 PM, 2019-05-20)\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_0\n delete:\n tags:\n - Status\n summary: Clear status\n responses:\n '200':\n description: OK\n /activity/:\n post:\n tags:\n - User activity\n summary: >-\n Sends user's activity to all subscribers; globally or per\n channel/message.\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_1\n channelID:\n type: string\n description: >-\n Channel ID, if set, activity will be send only to subscribed\n users\n messageID:\n type: string\n description: 'Message ID, if set, channelID must be set as well'\n kind:\n type: string\n description: Arbitrary string\n required:\n - kind\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_1\n /channels/:\n get:\n tags:\n - Channels\n summary: List channels\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: query\n description: Search query\n required: false\n schema: &ref_2\n type: string\n post:\n tags:\n - Channels\n summary: Create new channel\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_3\n name:\n type: string\n description: Name of Channel\n topic:\n type: string\n description: Subject of Channel\n type:\n type: string\n description: Channel type\n membershipPolicy:\n type: string\n description: 'Membership policy (eg: featured, forced)?'\n members:\n type: array\n items: *ref_2\n description: Initial members of the channel\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_3\n '/channels/{channelID}':\n put:\n tags:\n - Channels\n summary: Update channel details\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: &ref_5\n type: string\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_4\n name:\n type: string\n description: Name of Channel\n topic:\n type: string\n description: Subject of Channel\n membershipPolicy:\n type: string\n description: 'Membership policy (eg: featured, forced)?'\n type:\n type: string\n description: Channel type\n organisationID:\n type: string\n description: Move channel to different organisation\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_4\n get:\n tags:\n - Channels\n summary: Read channel details\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n '/channels/{channelID}/state':\n put:\n tags:\n - Channels\n summary: Update channel state\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_6\n state:\n type: string\n description: 'Valid values: delete, undelete, archive, unarchive'\n required:\n - state\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_6\n '/channels/{channelID}/flag':\n put:\n tags:\n - Channels\n summary: Update channel membership flag\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_7\n flag:\n type: string\n description: 'Valid values: pinned, hidden, ignored'\n required:\n - flag\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_7\n delete:\n tags:\n - Channels\n summary: Remove channel membership flag\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n '/channels/{channelID}/members':\n get:\n tags:\n - Channels\n summary: List channel members\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n '/channels/{channelID}/members/{userID}':\n put:\n tags:\n - Channels\n summary: Join channel\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: userID\n description: Member ID\n required: true\n schema: *ref_5\n delete:\n tags:\n - Channels\n summary: Remove member from channel\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: userID\n description: Member ID\n required: true\n schema: *ref_5\n '/channels/{channelID}/invite':\n post:\n tags:\n - Channels\n summary: Join channel\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_8\n userID:\n type: array\n items: *ref_2\n description: User ID\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_8\n '/channels/{channelID}/attach':\n post:\n tags:\n - Channels\n summary: Attach file to channel\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_9\n replyTo:\n type: string\n description: Upload as a reply\n upload:\n type: string\n format: binary\n description: File to upload\n required:\n - upload\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_9\n '/channels/{channelID}/messages/':\n post:\n tags:\n - Messages\n summary: Post new message to the channel\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_10\n message:\n type: string\n description: Message contents (markdown)\n required:\n - message\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_10\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n '/channels/{channelID}/messages/command/{command}/exec':\n post:\n tags:\n - Messages\n summary: Execute command\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: command\n description: Command to be executed\n required: true\n schema: *ref_2\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_11\n input:\n type: string\n description: Arbitrary command input\n params:\n type: array\n items: *ref_2\n description: Command parameters\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_11\n '/channels/{channelID}/messages/mark-as-read':\n get:\n tags:\n - Messages\n summary: Manages read/unread messages in a channel or a thread\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: query\n name: threadID\n description: 'ID of thread (messageID) '\n required: false\n schema: *ref_5\n - in: query\n name: lastReadMessageID\n description: ID of the last read message\n required: false\n schema: *ref_5\n '/channels/{channelID}/messages/{messageID}':\n put:\n tags:\n - Messages\n summary: Edit existing message\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: messageID\n description: Message ID\n required: true\n schema: *ref_5\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_12\n message:\n type: string\n description: Message contents (markdown)\n required:\n - message\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_12\n delete:\n tags:\n - Messages\n summary: Delete existing message\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: messageID\n description: Message ID\n required: true\n schema: *ref_5\n '/channels/{channelID}/messages/{messageID}/replies':\n post:\n tags:\n - Messages\n summary: Reply to a message\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: messageID\n description: Message ID\n required: true\n schema: *ref_5\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_13\n message:\n type: string\n description: Message contents (markdown)\n required:\n - message\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_13\n '/channels/{channelID}/messages/{messageID}/pin':\n post:\n tags:\n - Messages\n summary: Pin message to channel (public bookmark)\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: messageID\n description: Message ID\n required: true\n schema: *ref_5\n delete:\n tags:\n - Messages\n summary: Pin message to channel (public bookmark)\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: messageID\n description: Message ID\n required: true\n schema: *ref_5\n '/channels/{channelID}/messages/{messageID}/bookmark':\n post:\n tags:\n - Messages\n summary: Bookmark a message (private bookmark)\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: messageID\n description: Message ID\n required: true\n schema: *ref_5\n delete:\n tags:\n - Messages\n summary: Remove boomark from message (private bookmark)\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: messageID\n description: Message ID\n required: true\n schema: *ref_5\n '/channels/{channelID}/messages/{messageID}/reaction/{reaction}':\n post:\n tags:\n - Messages\n summary: React to a message\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: messageID\n description: Message ID\n required: true\n schema: *ref_5\n - in: path\n name: reaction\n description: Reaction\n required: true\n schema: *ref_2\n delete:\n tags:\n - Messages\n summary: Delete reaction from a message\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: channelID\n description: Channel ID\n required: true\n schema: *ref_5\n - in: path\n name: messageID\n description: Message ID\n required: true\n schema: *ref_5\n - in: path\n name: reaction\n description: Reaction\n required: true\n schema: *ref_2\n '/attachment/{attachmentID}/original/{name}':\n get:\n tags:\n - Attachments\n summary: Serves attached file\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: attachmentID\n description: Attachment ID\n required: true\n schema: *ref_5\n - in: path\n name: name\n description: File name\n required: true\n schema: *ref_2\n - in: query\n name: sign\n description: Signature\n required: true\n schema: *ref_2\n - in: query\n name: userID\n description: User ID\n required: true\n schema: *ref_5\n - in: query\n name: download\n description: Force file download\n required: false\n schema: &ref_14\n type: boolean\n '/attachment/{attachmentID}/preview.{ext}':\n get:\n tags:\n - Attachments\n summary: Serves preview of an attached file\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: attachmentID\n description: Attachment ID\n required: true\n schema: *ref_5\n - in: path\n name: ext\n description: Preview extension/format\n required: true\n schema: *ref_2\n - in: query\n name: sign\n description: Signature\n required: true\n schema: *ref_2\n - in: query\n name: userID\n description: User ID\n required: true\n schema: *ref_5\n /search/messages:\n get:\n tags:\n - Search entry point\n summary: Search for messages\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: query\n description: Search query\n required: false\n schema: *ref_2\n - in: query\n name: channelID\n description: Filter by channels\n required: false\n schema:\n type: array\n items: *ref_2\n - in: query\n name: afterMessageID\n description: ID of the first message in the list (exclusive)\n required: false\n schema: *ref_5\n - in: query\n name: beforeMessageID\n description: ID of the last message in the list (exclusive)\n required: false\n schema: *ref_5\n - in: query\n name: fromMessageID\n description: ID of the first message in the list (inclusive)\n required: false\n schema: *ref_5\n - in: query\n name: toMessageID\n description: ID of the last message the list (inclusive)\n required: false\n schema: *ref_5\n - in: query\n name: threadID\n description: Filter by thread message ID\n required: false\n schema:\n type: array\n items: *ref_2\n - in: query\n name: userID\n description: Filter by one or more user\n required: false\n schema:\n type: array\n items: *ref_2\n - in: query\n name: type\n description: 'Filter by message type (text, inlineImage, attachment, ...)'\n required: false\n schema:\n type: array\n items: *ref_2\n - in: query\n name: pinnedOnly\n description: Return only pinned messages\n required: false\n schema: *ref_14\n - in: query\n name: bookmarkedOnly\n description: Only bookmarked messages\n required: false\n schema: *ref_14\n - in: query\n name: limit\n description: Max number of messages\n required: false\n schema: &ref_15\n type: string\n /search/threads:\n get:\n tags:\n - Search entry point\n summary: Search for threads\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: query\n description: Search query\n required: false\n schema: *ref_2\n - in: query\n name: channelID\n description: Filter by channels\n required: false\n schema:\n type: array\n items: *ref_2\n - in: query\n name: limit\n description: Max number of messages\n required: false\n schema: *ref_15\n /permissions/:\n get:\n tags:\n - Permissions\n summary: Retrieve defined permissions\n responses:\n '200':\n description: OK\n /permissions/effective:\n get:\n tags:\n - Permissions\n summary: Effective rules for current user\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: resource\n description: Show only rules for a specific resource\n required: false\n schema: *ref_2\n '/permissions/{roleID}/rules':\n get:\n tags:\n - Permissions\n summary: Retrieve role permissions\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_5\n delete:\n tags:\n - Permissions\n summary: Remove all defined role permissions\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_5\n patch:\n tags:\n - Permissions\n summary: Update permission settings\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_5\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_16\n rules:\n type: array\n items:\n type: object\n properties:\n roleID:\n type: string\n format: uuid\n resource:\n type: string\n operation:\n type: string\n access:\n type: string\n description: List of permission rules to set\n required:\n - rules\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_16\nPK\x07\x08\x83J.D\x82^\x00\x00\x82^\x00\x00PK\x03\x04\x14\x00\x08\x00\x00\x00\x00\x00!(\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b\x00 \x00system.yamlUT\x05\x00\x01\x80Cm8openapi: 3.0.0\ninfo:\n title: Corteza System API\n description: Corteza System REST API definition\n version: 2020.9\n contact:\n email: info@cortezaproject.org\n license:\n name: Apache 2.0\n url: 'http://www.apache.org/licenses/LICENSE-2.0.html'\npaths:\n /auth/:\n get:\n tags:\n - Authentication\n summary: Returns auth settings\n responses:\n '200':\n description: OK\n /auth/check:\n get:\n tags:\n - Authentication\n summary: Check JWT token\n responses:\n '200':\n description: OK\n /auth/impersonate:\n post:\n tags:\n - Authentication\n summary: Impersonate a user\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_0\n userID:\n type: string\n description: ID of the impersonated user\n required:\n - userID\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_0\n /auth/exchange:\n post:\n tags:\n - Authentication\n summary: Exchange auth token for JWT\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_1\n token:\n type: string\n description: Token to be exchanged for JWT\n required:\n - token\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_1\n /auth/logout:\n get:\n tags:\n - Authentication\n summary: Logout\n responses:\n '200':\n description: OK\n /auth/internal/login:\n post:\n tags:\n - Internal authentication\n summary: Login user\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_2\n email:\n type: string\n description: Email\n password:\n type: string\n format: password\n description: Password\n required:\n - email\n - password\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_2\n /auth/internal/signup:\n post:\n tags:\n - Internal authentication\n summary: User signup/registration\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_3\n email:\n type: string\n description: Email\n username:\n type: string\n description: Username\n password:\n type: string\n format: password\n description: Password\n handle:\n type: string\n description: User handle\n name:\n type: string\n description: Display name\n required:\n - email\n - password\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_3\n /auth/internal/request-password-reset:\n post:\n tags:\n - Internal authentication\n summary: Request password reset token (via email)\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_4\n email:\n type: string\n description: Email\n required:\n - email\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_4\n /auth/internal/exchange-password-reset-token:\n post:\n tags:\n - Internal authentication\n summary: Exchange password reset token for new token and user info\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_5\n token:\n type: string\n description: Token\n required:\n - token\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_5\n /auth/internal/reset-password:\n post:\n tags:\n - Internal authentication\n summary: Reset password with exchanged password reset token\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_6\n token:\n type: string\n description: Token\n password:\n type: string\n format: password\n description: Password\n required:\n - token\n - password\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_6\n /auth/internal/confirm-email:\n post:\n tags:\n - Internal authentication\n summary: Confirm email with token\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_7\n token:\n type: string\n description: Token\n required:\n - token\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_7\n /auth/internal/change-password:\n post:\n tags:\n - Internal authentication\n summary: 'Changes password for current user, requires current password'\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_8\n oldPassword:\n type: string\n description: Old password\n newPassword:\n type: string\n description: New password\n required:\n - oldPassword\n - newPassword\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_8\n /settings/:\n get:\n tags:\n - Settings\n summary: List settings\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: prefix\n description: Key prefix\n required: false\n schema: &ref_10\n type: string\n patch:\n tags:\n - Settings\n summary: Update settings\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_9\n values:\n type: array\n items:\n type: object\n properties:\n name:\n type: string\n value:\n type: string\n description: >-\n Array of new settings: `[{ name: ..., value: ... }]`. Omit\n value to remove setting\n required:\n - values\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_9\n '/settings/{key}':\n get:\n tags:\n - Settings\n summary: Get a value for a key\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: key\n description: Setting key\n required: true\n schema: *ref_10\n - in: query\n name: ownerID\n description: Owner ID\n required: false\n schema: &ref_14\n type: string\n post:\n tags:\n - Settings\n summary: Set value for specific setting\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: key\n description: Key\n required: true\n schema: *ref_10\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_11\n upload:\n type: string\n format: binary\n description: File to upload\n ownerID:\n type: string\n description: Owner ID\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_11\n /settings/current:\n get:\n tags:\n - Settings\n summary: Current compose settings\n responses:\n '200':\n description: OK\n /subscription/:\n get:\n tags:\n - Subscription\n summary: Returns current subscription status\n responses:\n '200':\n description: OK\n /roles/:\n get:\n tags:\n - Roles\n summary: List roles\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: query\n description: Search query\n required: false\n schema: *ref_10\n - in: query\n name: deleted\n description: 'Exclude (0, default), include (1) or return only (2) deleted roles'\n required: false\n schema: &ref_12\n type: string\n - in: query\n name: archived\n description: 'Exclude (0, default), include (1) or return only (2) achived roles'\n required: false\n schema: *ref_12\n - in: query\n name: limit\n description: Limit\n required: false\n schema: *ref_12\n - in: query\n name: pageCursor\n description: Page cursor\n required: false\n schema: *ref_10\n - in: query\n name: sort\n description: Sort items\n required: false\n schema: *ref_10\n post:\n tags:\n - Roles\n summary: Update role details\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_13\n name:\n type: string\n description: Name of Role\n handle:\n type: string\n description: Handle for Role\n members:\n type: array\n items: *ref_10\n description: Role member IDs\n required:\n - name\n - handle\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_13\n '/roles/{roleID}':\n put:\n tags:\n - Roles\n summary: Update role details\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_15\n name:\n type: string\n description: Name of Role\n handle:\n type: string\n description: Handle for Role\n members:\n type: array\n items: *ref_10\n description: Role member IDs\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_15\n get:\n tags:\n - Roles\n summary: Read role details and memberships\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n delete:\n tags:\n - Roles\n summary: Remove role\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n '/roles/{roleID}/archive':\n post:\n tags:\n - Roles\n summary: Archive role\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n '/roles/{roleID}/unarchive':\n post:\n tags:\n - Roles\n summary: Unarchive role\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n '/roles/{roleID}/undelete':\n post:\n tags:\n - Roles\n summary: Undelete role\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n '/roles/{roleID}/move':\n post:\n tags:\n - Roles\n summary: Move role to different organisation\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_16\n organisationID:\n type: string\n description: Role ID\n required:\n - organisationID\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_16\n '/roles/{roleID}/merge':\n post:\n tags:\n - Roles\n summary: Merge one role into another\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Source Role ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_17\n destination:\n type: string\n description: Destination Role ID\n required:\n - destination\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_17\n '/roles/{roleID}/members':\n get:\n tags:\n - Roles\n summary: Returns all role members\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Source Role ID\n required: true\n schema: *ref_14\n '/roles/{roleID}/member/{userID}':\n post:\n tags:\n - Roles\n summary: Add member to a role\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Source Role ID\n required: true\n schema: *ref_14\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n delete:\n tags:\n - Roles\n summary: Remove member from a role\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Source Role ID\n required: true\n schema: *ref_14\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n '/roles/{roleID}/trigger':\n post:\n tags:\n - Roles\n summary: 'Fire system:role trigger'\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_18\n script:\n type: string\n description: Script to execute\n required:\n - script\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_18\n /users/:\n get:\n tags:\n - Users\n summary: Search users (Directory)\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: userID\n description: Filter by user ID\n required: false\n schema:\n type: array\n items: *ref_10\n - in: query\n name: roleID\n description: Filter by role membership\n required: false\n schema:\n type: array\n items: *ref_10\n - in: query\n name: query\n description: Search query to match against users\n required: false\n schema: *ref_10\n - in: query\n name: username\n description: Search username to match against users\n required: false\n schema: *ref_10\n - in: query\n name: email\n description: Search email to match against users\n required: false\n schema: *ref_10\n - in: query\n name: handle\n description: Search handle to match against users\n required: false\n schema: *ref_10\n - in: query\n name: kind\n description: 'Kind (normal, bot)'\n required: false\n schema:\n type: string\n - in: query\n name: incDeleted\n description: '[Deprecated] Include deleted users (requires ''access'' permission)'\n required: false\n schema: &ref_19\n type: boolean\n - in: query\n name: incSuspended\n description: '[Deprecated] Include suspended users'\n required: false\n schema: *ref_19\n - in: query\n name: deleted\n description: 'Exclude (0, default), include (1) or return only (2) deleted users'\n required: false\n schema: *ref_12\n - in: query\n name: suspended\n description: 'Exclude (0, default), include (1) or return only (2) suspended users'\n required: false\n schema: *ref_12\n - in: query\n name: limit\n description: Limit\n required: false\n schema: *ref_12\n - in: query\n name: pageCursor\n description: Page cursor\n required: false\n schema: *ref_10\n - in: query\n name: sort\n description: Sort items\n required: false\n schema: *ref_10\n post:\n tags:\n - Users\n summary: Create user\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_20\n email:\n type: string\n description: Email\n name:\n type: string\n description: Name\n handle:\n type: string\n description: Handle\n kind:\n type: string\n description: 'Kind (normal, bot)'\n required:\n - email\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_20\n '/users/{userID}':\n put:\n tags:\n - Users\n summary: Update user details\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_21\n email:\n type: string\n description: Email\n name:\n type: string\n description: Name\n handle:\n type: string\n description: Handle\n kind:\n type: string\n description: 'Kind (normal, bot)'\n required:\n - email\n - name\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_21\n get:\n tags:\n - Users\n summary: Read user details\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n delete:\n tags:\n - Users\n summary: Remove user\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n '/users/{userID}/suspend':\n post:\n tags:\n - Users\n summary: Suspend user\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n '/users/{userID}/unsuspend':\n post:\n tags:\n - Users\n summary: Unsuspend user\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n '/users/{userID}/undelete':\n post:\n tags:\n - Users\n summary: Undelete user\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n '/users/{userID}/password':\n post:\n tags:\n - Users\n summary: Set's or changes user's password\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_22\n password:\n type: string\n format: password\n description: New password\n required:\n - password\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_22\n '/users/{userID}/membership':\n get:\n tags:\n - Users\n summary: Add member to a role\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n '/users/{userID}/membership/{roleID}':\n post:\n tags:\n - Users\n summary: Add role to a user\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n delete:\n tags:\n - Users\n summary: Remove role from a user\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n - in: path\n name: userID\n description: User ID\n required: true\n schema: *ref_14\n '/users/{userID}/trigger':\n post:\n tags:\n - Users\n summary: 'Fire system:user trigger'\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: userID\n description: ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_23\n script:\n type: string\n description: Script to execute\n required:\n - script\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_23\n /application/:\n get:\n tags:\n - Applications\n summary: List applications\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: name\n description: Application name\n required: false\n schema: *ref_10\n - in: query\n name: query\n description: Filter applications\n required: false\n schema: *ref_10\n - in: query\n name: deleted\n description: 'Exclude (0, default), include (1) or return only (2) deleted roles'\n required: false\n schema: *ref_12\n - in: query\n name: limit\n description: Limit\n required: false\n schema: *ref_12\n - in: query\n name: pageCursor\n description: Page cursor\n required: false\n schema: *ref_10\n - in: query\n name: sort\n description: Sort items\n required: false\n schema: *ref_10\n post:\n tags:\n - Applications\n summary: Create application\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_24\n name:\n type: string\n description: Application name\n enabled:\n type: boolean\n description: Enabled\n unify:\n type: string\n format: json\n description: Unify properties\n config:\n type: string\n format: json\n description: Arbitrary JSON holding application configuration\n required:\n - name\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_24\n '/application/{applicationID}':\n put:\n tags:\n - Applications\n summary: Update user details\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: applicationID\n description: Application ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_25\n name:\n type: string\n description: Email\n enabled:\n type: boolean\n description: Enabled\n unify:\n type: string\n format: json\n description: Unify properties\n config:\n type: string\n format: json\n description: Arbitrary JSON holding application configuration\n required:\n - name\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_25\n get:\n tags:\n - Applications\n summary: Read application details\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: applicationID\n description: Application ID\n required: true\n schema: *ref_14\n delete:\n tags:\n - Applications\n summary: Remove application\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: applicationID\n description: Application ID\n required: true\n schema: *ref_14\n '/application/{applicationID}/undelete':\n post:\n tags:\n - Applications\n summary: Undelete application\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: applicationID\n description: Application ID\n required: true\n schema: *ref_14\n '/application/{applicationID}/trigger':\n post:\n tags:\n - Applications\n summary: 'Fire system:application trigger'\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: applicationID\n description: ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_26\n script:\n type: string\n description: Script to execute\n required:\n - script\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_26\n /permissions/:\n get:\n tags:\n - Permissions\n summary: Retrieve defined permissions\n responses:\n '200':\n description: OK\n /permissions/effective:\n get:\n tags:\n - Permissions\n summary: Effective rules for current user\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: resource\n description: Show only rules for a specific resource\n required: false\n schema: *ref_10\n '/permissions/{roleID}/rules':\n get:\n tags:\n - Permissions\n summary: Retrieve role permissions\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n delete:\n tags:\n - Permissions\n summary: Remove all defined role permissions\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n patch:\n tags:\n - Permissions\n summary: Update permission settings\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: roleID\n description: Role ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_27\n rules:\n type: array\n items:\n type: object\n properties:\n roleID:\n type: string\n format: uuid\n resource:\n type: string\n operation:\n type: string\n access:\n type: string\n description: List of permission rules to set\n required:\n - rules\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_27\n /reminder/:\n get:\n tags:\n - Reminders\n summary: List/read reminders\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: reminderID\n description: Filter by reminder ID\n required: false\n schema:\n type: array\n items: *ref_10\n - in: query\n name: resource\n description: Only reminders of a specific resource\n required: false\n schema: *ref_10\n - in: query\n name: assignedTo\n description: Only reminders for a given user\n required: false\n schema: *ref_14\n - in: query\n name: scheduledFrom\n description: Only reminders from this time (included)\n required: false\n schema: &ref_28\n type: string\n format: date-time\n - in: query\n name: scheduledUntil\n description: Only reminders up to this time (included)\n required: false\n schema: *ref_28\n - in: query\n name: scheduledOnly\n description: Only scheduled reminders\n required: false\n schema: *ref_19\n - in: query\n name: excludeDismissed\n description: Filter out dismissed reminders\n required: false\n schema: *ref_19\n - in: query\n name: limit\n description: Limit\n required: false\n schema: *ref_12\n - in: query\n name: pageCursor\n description: Page cursor\n required: false\n schema: *ref_10\n - in: query\n name: sort\n description: Sort items\n required: false\n schema: *ref_10\n post:\n tags:\n - Reminders\n summary: Add new reminder\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_29\n resource:\n type: string\n description: Resource\n assignedTo:\n type: string\n description: Assigned To\n payload:\n type: string\n format: json\n description: Payload\n remindAt:\n type: string\n format: date-time\n description: Remind At\n required:\n - resource\n - assignedTo\n - payload\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_29\n '/reminder/{reminderID}':\n put:\n tags:\n - Reminders\n summary: Update reminder\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: reminderID\n description: Reminder ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_30\n resource:\n type: string\n description: Resource\n assignedTo:\n type: string\n description: Assigned To\n payload:\n type: string\n format: json\n description: Payload\n remindAt:\n type: string\n format: date-time\n description: Remind At\n required:\n - resource\n - assignedTo\n - payload\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_30\n get:\n tags:\n - Reminders\n summary: Read reminder by ID\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: reminderID\n description: Reminder ID\n required: true\n schema: *ref_14\n delete:\n tags:\n - Reminders\n summary: Delete reminder\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: reminderID\n description: Reminder ID\n required: true\n schema: *ref_14\n '/reminder/{reminderID}/dismiss':\n patch:\n tags:\n - Reminders\n summary: Dismiss reminder\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: reminderID\n description: reminder ID\n required: true\n schema: *ref_14\n '/reminder/{reminderID}/snooze':\n patch:\n tags:\n - Reminders\n summary: Snooze reminder\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: reminderID\n description: reminder ID\n required: true\n schema: *ref_14\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_31\n remindAt:\n type: string\n format: date-time\n description: New Remind At Time\n required:\n - remindAt\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_31\n '/attachment/{kind}/{attachmentID}':\n get:\n tags:\n - Attachments\n summary: Attachment details\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: kind\n description: Kind\n required: true\n schema: *ref_10\n - in: path\n name: attachmentID\n description: Attachment ID\n required: true\n schema: *ref_14\n - in: query\n name: sign\n description: Signature\n required: false\n schema: *ref_10\n - in: query\n name: userID\n description: User ID\n required: false\n schema: *ref_14\n delete:\n tags:\n - Attachments\n summary: Delete attachment\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: kind\n description: Kind\n required: true\n schema: *ref_10\n - in: path\n name: attachmentID\n description: Attachment ID\n required: true\n schema: *ref_14\n - in: query\n name: sign\n description: Signature\n required: false\n schema: *ref_10\n - in: query\n name: userID\n description: User ID\n required: false\n schema: *ref_14\n '/attachment/{kind}/{attachmentID}/original/{name}':\n get:\n tags:\n - Attachments\n summary: Serves attached file\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: kind\n description: Kind\n required: true\n schema: *ref_10\n - in: path\n name: attachmentID\n description: Attachment ID\n required: true\n schema: *ref_14\n - in: path\n name: name\n description: File name\n required: true\n schema: *ref_10\n - in: query\n name: sign\n description: Signature\n required: false\n schema: *ref_10\n - in: query\n name: userID\n description: User ID\n required: false\n schema: *ref_14\n - in: query\n name: download\n description: Force file download\n required: false\n schema: *ref_19\n '/attachment/{kind}/{attachmentID}/preview.{ext}':\n get:\n tags:\n - Attachments\n summary: Serves preview of an attached file\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: kind\n description: Kind\n required: true\n schema: *ref_10\n - in: path\n name: attachmentID\n description: Attachment ID\n required: true\n schema: *ref_14\n - in: path\n name: ext\n description: Preview extension/format\n required: true\n schema: *ref_10\n - in: query\n name: sign\n description: Signature\n required: false\n schema: *ref_10\n - in: query\n name: userID\n description: User ID\n required: false\n schema: *ref_14\n /stats/:\n get:\n tags:\n - Statistics\n summary: List system statistics\n responses:\n '200':\n description: OK\n /automation/:\n get:\n tags:\n - System automation scripts\n summary: List all available automation scripts for system resources\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: resourceTypePrefixes\n description: Filter by resource prefix\n required: false\n schema:\n type: array\n items: *ref_10\n - in: query\n name: resourceTypes\n description: Filter by resource type\n required: false\n schema:\n type: array\n items: *ref_10\n - in: query\n name: eventTypes\n description: Filter by event type\n required: false\n schema:\n type: array\n items: *ref_10\n - in: query\n name: excludeInvalid\n description: Exclude scripts that can not be used (errors)\n required: false\n schema: *ref_19\n - in: query\n name: excludeClientScripts\n description: Do not include client scripts\n required: false\n schema: *ref_19\n - in: query\n name: excludeServerScripts\n description: Do not include server scripts\n required: false\n schema: *ref_19\n '/automation/{bundle}-{type}.{ext}':\n get:\n tags:\n - System automation scripts\n summary: Serves client scripts bundle\n responses:\n '200':\n description: OK\n parameters:\n - in: path\n name: bundle\n description: Name of the bundle\n required: true\n schema: *ref_10\n - in: path\n name: type\n description: Bundle type\n required: true\n schema: *ref_10\n - in: path\n name: ext\n description: Bundle extension\n required: true\n schema: *ref_10\n /automation/trigger:\n post:\n tags:\n - System automation scripts\n summary: Triggers execution of a specific script on a system service level\n responses:\n '200':\n description: OK\n requestBody:\n content:\n application/json:\n schema:\n type: object\n properties: &ref_32\n script:\n type: string\n description: Script to execute\n required:\n - script\n application/x-www-form-urlencoded:\n schema:\n type: object\n properties: *ref_32\n /actionlog/:\n get:\n tags:\n - Action log\n summary: Action log events\n responses:\n '200':\n description: OK\n parameters:\n - in: query\n name: from\n description: From\n required: false\n schema: *ref_28\n - in: query\n name: to\n description: To\n required: false\n schema: *ref_28\n - in: query\n name: resource\n description: Resource\n required: false\n schema: *ref_10\n - in: query\n name: action\n description: Action\n required: false\n schema: *ref_10\n - in: query\n name: actorID\n description: Filter by one or more actors\n required: false\n schema:\n type: array\n items: *ref_10\n - in: query\n name: limit\n description: Limit\n required: false\n schema: *ref_12\n - in: query\n name: pageCursor\n description: Page cursor\n required: false\n schema: *ref_10\nPK\x07\x08\x1c\xc1\xc8\xd4H\xb1\x00\x00H\xb1\x00\x00PK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x00\x00\x00!($jr\x0dN\x03\x00\x00N\x03\x00\x00\x0b\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x00\x00\x00\x00README.adocUT\x05\x00\x01\x80Cm8PK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x00\x00\x00!(\xf4\xc4\xa2\x1d\xdb\xc9\x00\x00\xdb\xc9\x00\x00\x0c\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x90\x03\x00\x00compose.yamlUT\x05\x00\x01\x80Cm8PK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x00\x00\x00!(;\xaaT,B\x07\x00\x00B\x07\x00\x00\n\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\xae\xcd\x00\x00index.htmlUT\x05\x00\x01\x80Cm8PK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x00\x00\x00!(\x83J.D\x82^\x00\x00\x82^\x00\x00\x0e\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x811\xd5\x00\x00messaging.yamlUT\x05\x00\x01\x80Cm8PK\x01\x02\x14\x03\x14\x00\x08\x00\x00\x00\x00\x00!(\x1c\xc1\xc8\xd4H\xb1\x00\x00H\xb1\x00\x00\x0b\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\xf83\x01\x00system.yamlUT\x05\x00\x01\x80Cm8PK\x05\x06\x00\x00\x00\x00\x05\x00\x05\x00M\x01\x00\x00\x82\xe5\x01\x00\x00\x00" diff --git a/docs/system.yaml b/docs/system.yaml new file mode 100644 index 000000000..755562b98 --- /dev/null +++ b/docs/system.yaml @@ -0,0 +1,1781 @@ +openapi: 3.0.0 +info: + title: Corteza System API + description: Corteza System REST API definition + version: 2020.9 + contact: + email: info@cortezaproject.org + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /auth/: + get: + tags: + - Authentication + summary: Returns auth settings + responses: + '200': + description: OK + /auth/check: + get: + tags: + - Authentication + summary: Check JWT token + responses: + '200': + description: OK + /auth/impersonate: + post: + tags: + - Authentication + summary: Impersonate a user + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_0 + userID: + type: string + description: ID of the impersonated user + required: + - userID + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_0 + /auth/exchange: + post: + tags: + - Authentication + summary: Exchange auth token for JWT + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_1 + token: + type: string + description: Token to be exchanged for JWT + required: + - token + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_1 + /auth/logout: + get: + tags: + - Authentication + summary: Logout + responses: + '200': + description: OK + /auth/internal/login: + post: + tags: + - Internal authentication + summary: Login user + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_2 + email: + type: string + description: Email + password: + type: string + format: password + description: Password + required: + - email + - password + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_2 + /auth/internal/signup: + post: + tags: + - Internal authentication + summary: User signup/registration + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_3 + email: + type: string + description: Email + username: + type: string + description: Username + password: + type: string + format: password + description: Password + handle: + type: string + description: User handle + name: + type: string + description: Display name + required: + - email + - password + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_3 + /auth/internal/request-password-reset: + post: + tags: + - Internal authentication + summary: Request password reset token (via email) + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_4 + email: + type: string + description: Email + required: + - email + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_4 + /auth/internal/exchange-password-reset-token: + post: + tags: + - Internal authentication + summary: Exchange password reset token for new token and user info + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_5 + token: + type: string + description: Token + required: + - token + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_5 + /auth/internal/reset-password: + post: + tags: + - Internal authentication + summary: Reset password with exchanged password reset token + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_6 + token: + type: string + description: Token + password: + type: string + format: password + description: Password + required: + - token + - password + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_6 + /auth/internal/confirm-email: + post: + tags: + - Internal authentication + summary: Confirm email with token + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_7 + token: + type: string + description: Token + required: + - token + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_7 + /auth/internal/change-password: + post: + tags: + - Internal authentication + summary: 'Changes password for current user, requires current password' + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_8 + oldPassword: + type: string + description: Old password + newPassword: + type: string + description: New password + required: + - oldPassword + - newPassword + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_8 + /settings/: + get: + tags: + - Settings + summary: List settings + responses: + '200': + description: OK + parameters: + - in: query + name: prefix + description: Key prefix + required: false + schema: &ref_10 + type: string + patch: + tags: + - Settings + summary: Update settings + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_9 + values: + type: array + items: + type: object + properties: + name: + type: string + value: + type: string + description: >- + Array of new settings: `[{ name: ..., value: ... }]`. Omit + value to remove setting + required: + - values + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_9 + '/settings/{key}': + get: + tags: + - Settings + summary: Get a value for a key + responses: + '200': + description: OK + parameters: + - in: path + name: key + description: Setting key + required: true + schema: *ref_10 + - in: query + name: ownerID + description: Owner ID + required: false + schema: &ref_14 + type: string + post: + tags: + - Settings + summary: Set value for specific setting + responses: + '200': + description: OK + parameters: + - in: path + name: key + description: Key + required: true + schema: *ref_10 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_11 + upload: + type: string + format: binary + description: File to upload + ownerID: + type: string + description: Owner ID + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_11 + /settings/current: + get: + tags: + - Settings + summary: Current compose settings + responses: + '200': + description: OK + /subscription/: + get: + tags: + - Subscription + summary: Returns current subscription status + responses: + '200': + description: OK + /roles/: + get: + tags: + - Roles + summary: List roles + responses: + '200': + description: OK + parameters: + - in: query + name: query + description: Search query + required: false + schema: *ref_10 + - in: query + name: deleted + description: 'Exclude (0, default), include (1) or return only (2) deleted roles' + required: false + schema: &ref_12 + type: string + - in: query + name: archived + description: 'Exclude (0, default), include (1) or return only (2) achived roles' + required: false + schema: *ref_12 + - in: query + name: limit + description: Limit + required: false + schema: *ref_12 + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_10 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_10 + post: + tags: + - Roles + summary: Update role details + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_13 + name: + type: string + description: Name of Role + handle: + type: string + description: Handle for Role + members: + type: array + items: *ref_10 + description: Role member IDs + required: + - name + - handle + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_13 + '/roles/{roleID}': + put: + tags: + - Roles + summary: Update role details + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_15 + name: + type: string + description: Name of Role + handle: + type: string + description: Handle for Role + members: + type: array + items: *ref_10 + description: Role member IDs + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_15 + get: + tags: + - Roles + summary: Read role details and memberships + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + delete: + tags: + - Roles + summary: Remove role + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + '/roles/{roleID}/archive': + post: + tags: + - Roles + summary: Archive role + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + '/roles/{roleID}/unarchive': + post: + tags: + - Roles + summary: Unarchive role + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + '/roles/{roleID}/undelete': + post: + tags: + - Roles + summary: Undelete role + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + '/roles/{roleID}/move': + post: + tags: + - Roles + summary: Move role to different organisation + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_16 + organisationID: + type: string + description: Role ID + required: + - organisationID + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_16 + '/roles/{roleID}/merge': + post: + tags: + - Roles + summary: Merge one role into another + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Source Role ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_17 + destination: + type: string + description: Destination Role ID + required: + - destination + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_17 + '/roles/{roleID}/members': + get: + tags: + - Roles + summary: Returns all role members + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Source Role ID + required: true + schema: *ref_14 + '/roles/{roleID}/member/{userID}': + post: + tags: + - Roles + summary: Add member to a role + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Source Role ID + required: true + schema: *ref_14 + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + delete: + tags: + - Roles + summary: Remove member from a role + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Source Role ID + required: true + schema: *ref_14 + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + '/roles/{roleID}/trigger': + post: + tags: + - Roles + summary: 'Fire system:role trigger' + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_18 + script: + type: string + description: Script to execute + required: + - script + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_18 + /users/: + get: + tags: + - Users + summary: Search users (Directory) + responses: + '200': + description: OK + parameters: + - in: query + name: userID + description: Filter by user ID + required: false + schema: + type: array + items: *ref_10 + - in: query + name: roleID + description: Filter by role membership + required: false + schema: + type: array + items: *ref_10 + - in: query + name: query + description: Search query to match against users + required: false + schema: *ref_10 + - in: query + name: username + description: Search username to match against users + required: false + schema: *ref_10 + - in: query + name: email + description: Search email to match against users + required: false + schema: *ref_10 + - in: query + name: handle + description: Search handle to match against users + required: false + schema: *ref_10 + - in: query + name: kind + description: 'Kind (normal, bot)' + required: false + schema: + type: string + - in: query + name: incDeleted + description: '[Deprecated] Include deleted users (requires ''access'' permission)' + required: false + schema: &ref_19 + type: boolean + - in: query + name: incSuspended + description: '[Deprecated] Include suspended users' + required: false + schema: *ref_19 + - in: query + name: deleted + description: 'Exclude (0, default), include (1) or return only (2) deleted users' + required: false + schema: *ref_12 + - in: query + name: suspended + description: 'Exclude (0, default), include (1) or return only (2) suspended users' + required: false + schema: *ref_12 + - in: query + name: limit + description: Limit + required: false + schema: *ref_12 + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_10 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_10 + post: + tags: + - Users + summary: Create user + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_20 + email: + type: string + description: Email + name: + type: string + description: Name + handle: + type: string + description: Handle + kind: + type: string + description: 'Kind (normal, bot)' + required: + - email + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_20 + '/users/{userID}': + put: + tags: + - Users + summary: Update user details + responses: + '200': + description: OK + parameters: + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_21 + email: + type: string + description: Email + name: + type: string + description: Name + handle: + type: string + description: Handle + kind: + type: string + description: 'Kind (normal, bot)' + required: + - email + - name + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_21 + get: + tags: + - Users + summary: Read user details + responses: + '200': + description: OK + parameters: + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + delete: + tags: + - Users + summary: Remove user + responses: + '200': + description: OK + parameters: + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + '/users/{userID}/suspend': + post: + tags: + - Users + summary: Suspend user + responses: + '200': + description: OK + parameters: + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + '/users/{userID}/unsuspend': + post: + tags: + - Users + summary: Unsuspend user + responses: + '200': + description: OK + parameters: + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + '/users/{userID}/undelete': + post: + tags: + - Users + summary: Undelete user + responses: + '200': + description: OK + parameters: + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + '/users/{userID}/password': + post: + tags: + - Users + summary: Set's or changes user's password + responses: + '200': + description: OK + parameters: + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_22 + password: + type: string + format: password + description: New password + required: + - password + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_22 + '/users/{userID}/membership': + get: + tags: + - Users + summary: Add member to a role + responses: + '200': + description: OK + parameters: + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + '/users/{userID}/membership/{roleID}': + post: + tags: + - Users + summary: Add role to a user + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + delete: + tags: + - Users + summary: Remove role from a user + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + - in: path + name: userID + description: User ID + required: true + schema: *ref_14 + '/users/{userID}/trigger': + post: + tags: + - Users + summary: 'Fire system:user trigger' + responses: + '200': + description: OK + parameters: + - in: path + name: userID + description: ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_23 + script: + type: string + description: Script to execute + required: + - script + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_23 + /application/: + get: + tags: + - Applications + summary: List applications + responses: + '200': + description: OK + parameters: + - in: query + name: name + description: Application name + required: false + schema: *ref_10 + - in: query + name: query + description: Filter applications + required: false + schema: *ref_10 + - in: query + name: deleted + description: 'Exclude (0, default), include (1) or return only (2) deleted roles' + required: false + schema: *ref_12 + - in: query + name: limit + description: Limit + required: false + schema: *ref_12 + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_10 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_10 + post: + tags: + - Applications + summary: Create application + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_24 + name: + type: string + description: Application name + enabled: + type: boolean + description: Enabled + unify: + type: string + format: json + description: Unify properties + config: + type: string + format: json + description: Arbitrary JSON holding application configuration + required: + - name + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_24 + '/application/{applicationID}': + put: + tags: + - Applications + summary: Update user details + responses: + '200': + description: OK + parameters: + - in: path + name: applicationID + description: Application ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_25 + name: + type: string + description: Email + enabled: + type: boolean + description: Enabled + unify: + type: string + format: json + description: Unify properties + config: + type: string + format: json + description: Arbitrary JSON holding application configuration + required: + - name + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_25 + get: + tags: + - Applications + summary: Read application details + responses: + '200': + description: OK + parameters: + - in: path + name: applicationID + description: Application ID + required: true + schema: *ref_14 + delete: + tags: + - Applications + summary: Remove application + responses: + '200': + description: OK + parameters: + - in: path + name: applicationID + description: Application ID + required: true + schema: *ref_14 + '/application/{applicationID}/undelete': + post: + tags: + - Applications + summary: Undelete application + responses: + '200': + description: OK + parameters: + - in: path + name: applicationID + description: Application ID + required: true + schema: *ref_14 + '/application/{applicationID}/trigger': + post: + tags: + - Applications + summary: 'Fire system:application trigger' + responses: + '200': + description: OK + parameters: + - in: path + name: applicationID + description: ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_26 + script: + type: string + description: Script to execute + required: + - script + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_26 + /permissions/: + get: + tags: + - Permissions + summary: Retrieve defined permissions + responses: + '200': + description: OK + /permissions/effective: + get: + tags: + - Permissions + summary: Effective rules for current user + responses: + '200': + description: OK + parameters: + - in: query + name: resource + description: Show only rules for a specific resource + required: false + schema: *ref_10 + '/permissions/{roleID}/rules': + get: + tags: + - Permissions + summary: Retrieve role permissions + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + delete: + tags: + - Permissions + summary: Remove all defined role permissions + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + patch: + tags: + - Permissions + summary: Update permission settings + responses: + '200': + description: OK + parameters: + - in: path + name: roleID + description: Role ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_27 + rules: + type: array + items: + type: object + properties: + roleID: + type: string + format: uuid + resource: + type: string + operation: + type: string + access: + type: string + description: List of permission rules to set + required: + - rules + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_27 + /reminder/: + get: + tags: + - Reminders + summary: List/read reminders + responses: + '200': + description: OK + parameters: + - in: query + name: reminderID + description: Filter by reminder ID + required: false + schema: + type: array + items: *ref_10 + - in: query + name: resource + description: Only reminders of a specific resource + required: false + schema: *ref_10 + - in: query + name: assignedTo + description: Only reminders for a given user + required: false + schema: *ref_14 + - in: query + name: scheduledFrom + description: Only reminders from this time (included) + required: false + schema: &ref_28 + type: string + format: date-time + - in: query + name: scheduledUntil + description: Only reminders up to this time (included) + required: false + schema: *ref_28 + - in: query + name: scheduledOnly + description: Only scheduled reminders + required: false + schema: *ref_19 + - in: query + name: excludeDismissed + description: Filter out dismissed reminders + required: false + schema: *ref_19 + - in: query + name: limit + description: Limit + required: false + schema: *ref_12 + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_10 + - in: query + name: sort + description: Sort items + required: false + schema: *ref_10 + post: + tags: + - Reminders + summary: Add new reminder + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_29 + resource: + type: string + description: Resource + assignedTo: + type: string + description: Assigned To + payload: + type: string + format: json + description: Payload + remindAt: + type: string + format: date-time + description: Remind At + required: + - resource + - assignedTo + - payload + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_29 + '/reminder/{reminderID}': + put: + tags: + - Reminders + summary: Update reminder + responses: + '200': + description: OK + parameters: + - in: path + name: reminderID + description: Reminder ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_30 + resource: + type: string + description: Resource + assignedTo: + type: string + description: Assigned To + payload: + type: string + format: json + description: Payload + remindAt: + type: string + format: date-time + description: Remind At + required: + - resource + - assignedTo + - payload + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_30 + get: + tags: + - Reminders + summary: Read reminder by ID + responses: + '200': + description: OK + parameters: + - in: path + name: reminderID + description: Reminder ID + required: true + schema: *ref_14 + delete: + tags: + - Reminders + summary: Delete reminder + responses: + '200': + description: OK + parameters: + - in: path + name: reminderID + description: Reminder ID + required: true + schema: *ref_14 + '/reminder/{reminderID}/dismiss': + patch: + tags: + - Reminders + summary: Dismiss reminder + responses: + '200': + description: OK + parameters: + - in: path + name: reminderID + description: reminder ID + required: true + schema: *ref_14 + '/reminder/{reminderID}/snooze': + patch: + tags: + - Reminders + summary: Snooze reminder + responses: + '200': + description: OK + parameters: + - in: path + name: reminderID + description: reminder ID + required: true + schema: *ref_14 + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_31 + remindAt: + type: string + format: date-time + description: New Remind At Time + required: + - remindAt + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_31 + '/attachment/{kind}/{attachmentID}': + get: + tags: + - Attachments + summary: Attachment details + responses: + '200': + description: OK + parameters: + - in: path + name: kind + description: Kind + required: true + schema: *ref_10 + - in: path + name: attachmentID + description: Attachment ID + required: true + schema: *ref_14 + - in: query + name: sign + description: Signature + required: false + schema: *ref_10 + - in: query + name: userID + description: User ID + required: false + schema: *ref_14 + delete: + tags: + - Attachments + summary: Delete attachment + responses: + '200': + description: OK + parameters: + - in: path + name: kind + description: Kind + required: true + schema: *ref_10 + - in: path + name: attachmentID + description: Attachment ID + required: true + schema: *ref_14 + - in: query + name: sign + description: Signature + required: false + schema: *ref_10 + - in: query + name: userID + description: User ID + required: false + schema: *ref_14 + '/attachment/{kind}/{attachmentID}/original/{name}': + get: + tags: + - Attachments + summary: Serves attached file + responses: + '200': + description: OK + parameters: + - in: path + name: kind + description: Kind + required: true + schema: *ref_10 + - in: path + name: attachmentID + description: Attachment ID + required: true + schema: *ref_14 + - in: path + name: name + description: File name + required: true + schema: *ref_10 + - in: query + name: sign + description: Signature + required: false + schema: *ref_10 + - in: query + name: userID + description: User ID + required: false + schema: *ref_14 + - in: query + name: download + description: Force file download + required: false + schema: *ref_19 + '/attachment/{kind}/{attachmentID}/preview.{ext}': + get: + tags: + - Attachments + summary: Serves preview of an attached file + responses: + '200': + description: OK + parameters: + - in: path + name: kind + description: Kind + required: true + schema: *ref_10 + - in: path + name: attachmentID + description: Attachment ID + required: true + schema: *ref_14 + - in: path + name: ext + description: Preview extension/format + required: true + schema: *ref_10 + - in: query + name: sign + description: Signature + required: false + schema: *ref_10 + - in: query + name: userID + description: User ID + required: false + schema: *ref_14 + /stats/: + get: + tags: + - Statistics + summary: List system statistics + responses: + '200': + description: OK + /automation/: + get: + tags: + - System automation scripts + summary: List all available automation scripts for system resources + responses: + '200': + description: OK + parameters: + - in: query + name: resourceTypePrefixes + description: Filter by resource prefix + required: false + schema: + type: array + items: *ref_10 + - in: query + name: resourceTypes + description: Filter by resource type + required: false + schema: + type: array + items: *ref_10 + - in: query + name: eventTypes + description: Filter by event type + required: false + schema: + type: array + items: *ref_10 + - in: query + name: excludeInvalid + description: Exclude scripts that can not be used (errors) + required: false + schema: *ref_19 + - in: query + name: excludeClientScripts + description: Do not include client scripts + required: false + schema: *ref_19 + - in: query + name: excludeServerScripts + description: Do not include server scripts + required: false + schema: *ref_19 + '/automation/{bundle}-{type}.{ext}': + get: + tags: + - System automation scripts + summary: Serves client scripts bundle + responses: + '200': + description: OK + parameters: + - in: path + name: bundle + description: Name of the bundle + required: true + schema: *ref_10 + - in: path + name: type + description: Bundle type + required: true + schema: *ref_10 + - in: path + name: ext + description: Bundle extension + required: true + schema: *ref_10 + /automation/trigger: + post: + tags: + - System automation scripts + summary: Triggers execution of a specific script on a system service level + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + type: object + properties: &ref_32 + script: + type: string + description: Script to execute + required: + - script + application/x-www-form-urlencoded: + schema: + type: object + properties: *ref_32 + /actionlog/: + get: + tags: + - Action log + summary: Action log events + responses: + '200': + description: OK + parameters: + - in: query + name: from + description: From + required: false + schema: *ref_28 + - in: query + name: to + description: To + required: false + schema: *ref_28 + - in: query + name: resource + description: Resource + required: false + schema: *ref_10 + - in: query + name: action + description: Action + required: false + schema: *ref_10 + - in: query + name: actorID + description: Filter by one or more actors + required: false + schema: + type: array + items: *ref_10 + - in: query + name: limit + description: Limit + required: false + schema: *ref_12 + - in: query + name: pageCursor + description: Page cursor + required: false + schema: *ref_10 diff --git a/docs/system/README.md b/docs/system/README.md deleted file mode 100644 index e52cdf5f5..000000000 --- a/docs/system/README.md +++ /dev/null @@ -1,1448 +0,0 @@ -# Action log - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/actionlog/` | Action log events | - -## Action log events - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/actionlog/` | HTTP/S | GET | -Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32 - | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| from | *time.Time | GET | From | N/A | NO | -| to | *time.Time | GET | To | N/A | NO | -| resource | string | GET | Resource | N/A | NO | -| action | string | GET | Action | N/A | NO | -| actorID | []string | GET | Filter by one or more actors | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | - ---- - - - - -# Applications - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/application/` | List applications | -| `POST` | `/application/` | Create application | -| `PUT` | `/application/{applicationID}` | Update user details | -| `GET` | `/application/{applicationID}` | Read application details | -| `DELETE` | `/application/{applicationID}` | Remove application | -| `POST` | `/application/{applicationID}/undelete` | Undelete application | -| `POST` | `/application/{applicationID}/trigger` | Fire system:application trigger | - -## List applications - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/application/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| name | string | GET | Application name | N/A | NO | -| query | string | GET | Filter applications | N/A | NO | -| deleted | uint | GET | Exclude (0, default), include (1) or return only (2) deleted roles | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | -| sort | string | GET | Sort items | N/A | NO | - -## Create application - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/application/` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| name | string | POST | Application name | N/A | YES | -| enabled | bool | POST | Enabled | N/A | NO | -| unify | sqlxTypes.JSONText | POST | Unify properties | N/A | NO | -| config | sqlxTypes.JSONText | POST | Arbitrary JSON holding application configuration | N/A | NO | - -## Update user details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/application/{applicationID}` | HTTP/S | PUT | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| applicationID | uint64 | PATH | Application ID | N/A | YES | -| name | string | POST | Email | N/A | YES | -| enabled | bool | POST | Enabled | N/A | NO | -| unify | sqlxTypes.JSONText | POST | Unify properties | N/A | NO | -| config | sqlxTypes.JSONText | POST | Arbitrary JSON holding application configuration | N/A | NO | - -## Read application details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/application/{applicationID}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| applicationID | uint64 | PATH | Application ID | N/A | YES | - -## Remove application - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/application/{applicationID}` | HTTP/S | DELETE | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| applicationID | uint64 | PATH | Application ID | N/A | YES | - -## Undelete application - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/application/{applicationID}/undelete` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| applicationID | uint64 | PATH | Application ID | N/A | YES | - -## Fire system:application trigger - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/application/{applicationID}/trigger` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| applicationID | uint64 | PATH | ID | N/A | YES | -| script | string | POST | Script to execute | N/A | YES | - ---- - - - - -# Attachments - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/attachment/{kind}/{attachmentID}` | Attachment details | -| `DELETE` | `/attachment/{kind}/{attachmentID}` | Delete attachment | -| `GET` | `/attachment/{kind}/{attachmentID}/original/{name}` | Serves attached file | -| `GET` | `/attachment/{kind}/{attachmentID}/preview.{ext}` | Serves preview of an attached file | - -## Attachment details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/attachment/{kind}/{attachmentID}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| attachmentID | uint64 | PATH | Attachment ID | N/A | YES | -| kind | string | PATH | Kind | N/A | YES | -| sign | string | GET | Signature | N/A | NO | -| userID | uint64 | GET | User ID | N/A | NO | - -## Delete attachment - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/attachment/{kind}/{attachmentID}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| attachmentID | uint64 | PATH | Attachment ID | N/A | YES | -| kind | string | PATH | Kind | N/A | YES | -| sign | string | GET | Signature | N/A | NO | -| userID | uint64 | GET | User ID | N/A | NO | - -## Serves attached file - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/attachment/{kind}/{attachmentID}/original/{name}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| download | bool | GET | Force file download | N/A | NO | -| sign | string | GET | Signature | N/A | NO | -| userID | uint64 | GET | User ID | N/A | NO | -| attachmentID | uint64 | PATH | Attachment ID | N/A | YES | -| name | string | PATH | File name | N/A | YES | -| kind | string | PATH | Kind | N/A | YES | - -## Serves preview of an attached file - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/attachment/{kind}/{attachmentID}/preview.{ext}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| attachmentID | uint64 | PATH | Attachment ID | N/A | YES | -| ext | string | PATH | Preview extension/format | N/A | YES | -| kind | string | PATH | Kind | N/A | YES | -| sign | string | GET | Signature | N/A | NO | -| userID | uint64 | GET | User ID | N/A | NO | - ---- - - - - -# Authentication - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/auth/` | Returns auth settings | -| `GET` | `/auth/check` | Check JWT token | -| `POST` | `/auth/impersonate` | Impersonate a user | -| `POST` | `/auth/exchange` | Exchange auth token for JWT | -| `GET` | `/auth/logout` | Logout | - -## Returns auth settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - -## Check JWT token - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/check` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - -## Impersonate a user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/impersonate` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | uint64 | POST | ID of the impersonated user | N/A | YES | -| expire | int | POST | expiration time in seconds, must be shorter than 24h | N/A | NO | - -## Exchange auth token for JWT - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/exchange` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| token | string | POST | Token to be exchanged for JWT | N/A | YES | - -## Logout - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/logout` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - ---- - - - - -# Internal authentication - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `POST` | `/auth/internal/login` | Login user | -| `POST` | `/auth/internal/signup` | User signup/registration | -| `POST` | `/auth/internal/request-password-reset` | Request password reset token (via email) | -| `POST` | `/auth/internal/exchange-password-reset-token` | Exchange password reset token for new token and user info | -| `POST` | `/auth/internal/reset-password` | Reset password with exchanged password reset token | -| `POST` | `/auth/internal/confirm-email` | Confirm email with token | -| `POST` | `/auth/internal/change-password` | Changes password for current user, requires current password | - -## Login user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/internal/login` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| email | string | POST | Email | N/A | YES | -| password | string | POST | Password | N/A | YES | - -## User signup/registration - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/internal/signup` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| email | string | POST | Email | N/A | YES | -| username | string | POST | Username | N/A | NO | -| password | string | POST | Password | N/A | YES | -| handle | string | POST | User handle | N/A | NO | -| name | string | POST | Display name | N/A | NO | - -## Request password reset token (via email) - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/internal/request-password-reset` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| email | string | POST | Email | N/A | YES | - -## Exchange password reset token for new token and user info - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/internal/exchange-password-reset-token` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| token | string | POST | Token | N/A | YES | - -## Reset password with exchanged password reset token - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/internal/reset-password` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| token | string | POST | Token | N/A | YES | -| password | string | POST | Password | N/A | YES | - -## Confirm email with token - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/internal/confirm-email` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| token | string | POST | Token | N/A | YES | - -## Changes password for current user, requires current password - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/auth/internal/change-password` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| oldPassword | string | POST | Old password | N/A | YES | -| newPassword | string | POST | New password | N/A | YES | - ---- - - - - -# System automation scripts - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/automation/` | List all available automation scripts for system resources | -| `GET` | `/automation/{bundle}-{type}.{ext}` | Serves client scripts bundle | -| `POST` | `/automation/trigger` | Triggers execution of a specific script on a system service level | - -## List all available automation scripts for system resources - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/automation/` | HTTP/S | GET | -Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32 - | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| resourceTypePrefixes | []string | GET | Filter by resource prefix | N/A | NO | -| resourceTypes | []string | GET | Filter by resource type | N/A | NO | -| eventTypes | []string | GET | Filter by event type | N/A | NO | -| excludeInvalid | bool | GET | Exclude scripts that can not be used (errors) | N/A | NO | -| excludeClientScripts | bool | GET | Do not include client scripts | N/A | NO | -| excludeServerScripts | bool | GET | Do not include server scripts | N/A | NO | - -## Serves client scripts bundle - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/automation/{bundle}-{type}.{ext}` | HTTP/S | GET | -Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32 - | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| bundle | string | PATH | Name of the bundle | N/A | NO | -| type | string | PATH | Bundle type | N/A | NO | -| ext | string | PATH | Bundle extension | N/A | NO | - -## Triggers execution of a specific script on a system service level - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/automation/trigger` | HTTP/S | POST | -Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32 - | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| script | string | POST | Script to execute | N/A | YES | - ---- - - - - -# Organisations - -Organisations represent a top-level grouping entity. There may be many organisations defined in a single deployment. - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/organisations/` | List organisations | -| `POST` | `/organisations/` | Create organisation | -| `PUT` | `/organisations/{id}` | Update organisation details | -| `DELETE` | `/organisations/{id}` | Remove organisation | -| `GET` | `/organisations/{id}` | Read organisation details | -| `POST` | `/organisations/{id}/archive` | Archive organisation | - -## List organisations - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/organisations/` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| query | string | GET | Search query | N/A | NO | - -## Create organisation - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/organisations/` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| name | string | POST | Organisation Name | N/A | YES | - -## Update organisation details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/organisations/{id}` | HTTP/S | PUT | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| id | uint64 | PATH | Organisation ID | N/A | NO | -| name | string | POST | Organisation Name | N/A | YES | - -## Remove organisation - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/organisations/{id}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| id | uint64 | PATH | Organisation ID | N/A | YES | - -## Read organisation details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/organisations/{id}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| id | uint64 | PATH | Organisation ID | N/A | YES | - -## Archive organisation - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/organisations/{id}/archive` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| id | uint64 | PATH | Organisation ID | N/A | YES | - ---- - - - - -# Permissions - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/permissions/` | Retrieve defined permissions | -| `GET` | `/permissions/effective` | Effective rules for current user | -| `GET` | `/permissions/{roleID}/rules` | Retrieve role permissions | -| `DELETE` | `/permissions/{roleID}/rules` | Remove all defined role permissions | -| `PATCH` | `/permissions/{roleID}/rules` | Update permission settings | - -## Retrieve defined permissions - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - -## Effective rules for current user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/effective` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| resource | string | GET | Show only rules for a specific resource | N/A | NO | - -## Retrieve role permissions - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/{roleID}/rules` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Remove all defined role permissions - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/{roleID}/rules` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Update permission settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/permissions/{roleID}/rules` | HTTP/S | PATCH | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | -| rules | permissions.RuleSet | POST | List of permission rules to set | N/A | YES | - ---- - - - - -# Reminders - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/reminder/` | List/read reminders | -| `POST` | `/reminder/` | Add new reminder | -| `PUT` | `/reminder/{reminderID}` | Update reminder | -| `GET` | `/reminder/{reminderID}` | Read reminder by ID | -| `DELETE` | `/reminder/{reminderID}` | Delete reminder | -| `PATCH` | `/reminder/{reminderID}/dismiss` | Dismiss reminder | -| `PATCH` | `/reminder/{reminderID}/snooze` | Snooze reminder | - -## List/read reminders - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/reminder/` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| reminderID | []string | GET | Filter by reminder ID | N/A | NO | -| resource | string | GET | Only reminders of a specific resource | N/A | NO | -| assignedTo | uint64 | GET | Only reminders for a given user | N/A | NO | -| scheduledFrom | *time.Time | GET | Only reminders from this time (included) | N/A | NO | -| scheduledUntil | *time.Time | GET | Only reminders up to this time (included) | N/A | NO | -| scheduledOnly | bool | GET | Only scheduled reminders | N/A | NO | -| excludeDismissed | bool | GET | Filter out dismissed reminders | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | -| sort | string | GET | Sort items | N/A | NO | - -## Add new reminder - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/reminder/` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| resource | string | POST | Resource | N/A | YES | -| assignedTo | uint64 | POST | Assigned To | N/A | YES | -| payload | sqlxTypes.JSONText | POST | Payload | N/A | YES | -| remindAt | *time.Time | POST | Remind At | N/A | NO | - -## Update reminder - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/reminder/{reminderID}` | HTTP/S | PUT | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| reminderID | uint64 | PATH | Reminder ID | N/A | YES | -| resource | string | POST | Resource | N/A | YES | -| assignedTo | uint64 | POST | Assigned To | N/A | YES | -| payload | sqlxTypes.JSONText | POST | Payload | N/A | YES | -| remindAt | *time.Time | POST | Remind At | N/A | NO | - -## Read reminder by ID - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/reminder/{reminderID}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| reminderID | uint64 | PATH | Reminder ID | N/A | YES | - -## Delete reminder - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/reminder/{reminderID}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| reminderID | uint64 | PATH | Reminder ID | N/A | YES | - -## Dismiss reminder - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/reminder/{reminderID}/dismiss` | HTTP/S | PATCH | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| reminderID | uint64 | PATH | reminder ID | N/A | YES | - -## Snooze reminder - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/reminder/{reminderID}/snooze` | HTTP/S | PATCH | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| reminderID | uint64 | PATH | reminder ID | N/A | YES | -| remindAt | *time.Time | POST | New Remind At Time | N/A | YES | - ---- - - - - -# Roles - -An organisation may have many roles. Roles may have many channels available. Access to channels may be shared between roles. - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/roles/` | List roles | -| `POST` | `/roles/` | Update role details | -| `PUT` | `/roles/{roleID}` | Update role details | -| `GET` | `/roles/{roleID}` | Read role details and memberships | -| `DELETE` | `/roles/{roleID}` | Remove role | -| `POST` | `/roles/{roleID}/archive` | Archive role | -| `POST` | `/roles/{roleID}/unarchive` | Unarchive role | -| `POST` | `/roles/{roleID}/undelete` | Undelete role | -| `POST` | `/roles/{roleID}/move` | Move role to different organisation | -| `POST` | `/roles/{roleID}/merge` | Merge one role into another | -| `GET` | `/roles/{roleID}/members` | Returns all role members | -| `POST` | `/roles/{roleID}/member/{userID}` | Add member to a role | -| `DELETE` | `/roles/{roleID}/member/{userID}` | Remove member from a role | -| `POST` | `/roles/{roleID}/trigger` | Fire system:role trigger | - -## List roles - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| query | string | GET | Search query | N/A | NO | -| deleted | uint | GET | Exclude (0, default), include (1) or return only (2) deleted roles | N/A | NO | -| archived | uint | GET | Exclude (0, default), include (1) or return only (2) achived roles | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | -| sort | string | GET | Sort items | N/A | NO | - -## Update role details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| name | string | POST | Name of Role | N/A | YES | -| handle | string | POST | Handle for Role | N/A | YES | -| members | []string | POST | Role member IDs | N/A | NO | - -## Update role details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}` | HTTP/S | PUT | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | -| name | string | POST | Name of Role | N/A | NO | -| handle | string | POST | Handle for Role | N/A | NO | -| members | []string | POST | Role member IDs | N/A | NO | - -## Read role details and memberships - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Remove role - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Archive role - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}/archive` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Unarchive role - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}/unarchive` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Undelete role - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}/undelete` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | - -## Move role to different organisation - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}/move` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | -| organisationID | uint64 | POST | Role ID | N/A | YES | - -## Merge one role into another - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}/merge` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Source Role ID | N/A | YES | -| destination | uint64 | POST | Destination Role ID | N/A | YES | - -## Returns all role members - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}/members` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Source Role ID | N/A | YES | - -## Add member to a role - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}/member/{userID}` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Source Role ID | N/A | YES | -| userID | uint64 | PATH | User ID | N/A | YES | - -## Remove member from a role - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}/member/{userID}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Source Role ID | N/A | YES | -| userID | uint64 | PATH | User ID | N/A | YES | - -## Fire system:role trigger - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/roles/{roleID}/trigger` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | ID | N/A | YES | -| script | string | POST | Script to execute | N/A | YES | - ---- - - - - -# Settings - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/settings/` | List settings | -| `PATCH` | `/settings/` | Update settings | -| `GET` | `/settings/{key}` | Get a value for a key | -| `POST` | `/settings/{key}` | Set value for specific setting | -| `GET` | `/settings/current` | Current compose settings | - -## List settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| prefix | string | GET | Key prefix | N/A | NO | - -## Update settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/` | HTTP/S | PATCH | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| values | settings.ValueSet | POST | Array of new settings: `[{ name: ..., value: ... }]`. Omit value to remove setting | N/A | YES | - -## Get a value for a key - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/{key}` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| ownerID | uint64 | GET | Owner ID | N/A | NO | -| key | string | PATH | Setting key | N/A | YES | - -## Set value for specific setting - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/{key}` | HTTP/S | POST | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| key | string | PATH | Key | N/A | YES | -| upload | *multipart.FileHeader | POST | File to upload | N/A | NO | -| ownerID | uint64 | POST | Owner ID | N/A | NO | - -## Current compose settings - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/settings/current` | HTTP/S | GET | | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - ---- - - - - -# Statistics - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/stats/` | List system statistics | - -## List system statistics - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/stats/` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - ---- - - - - -# Subscription - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/subscription/` | Returns current subscription status | - -## Returns current subscription status - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/subscription/` | HTTP/S | GET | -Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32 - | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | - ---- - - - - -# Users - -| Method | Endpoint | Purpose | -| ------ | -------- | ------- | -| `GET` | `/users/` | Search users (Directory) | -| `POST` | `/users/` | Create user | -| `PUT` | `/users/{userID}` | Update user details | -| `GET` | `/users/{userID}` | Read user details | -| `DELETE` | `/users/{userID}` | Remove user | -| `POST` | `/users/{userID}/suspend` | Suspend user | -| `POST` | `/users/{userID}/unsuspend` | Unsuspend user | -| `POST` | `/users/{userID}/undelete` | Undelete user | -| `POST` | `/users/{userID}/password` | Set's or changes user's password | -| `GET` | `/users/{userID}/membership` | Add member to a role | -| `POST` | `/users/{userID}/membership/{roleID}` | Add role to a user | -| `DELETE` | `/users/{userID}/membership/{roleID}` | Remove role from a user | -| `POST` | `/users/{userID}/trigger` | Fire system:user trigger | - -## Search users (Directory) - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | []string | GET | Filter by user ID | N/A | NO | -| roleID | []string | GET | Filter by role membership | N/A | NO | -| query | string | GET | Search query to match against users | N/A | NO | -| username | string | GET | Search username to match against users | N/A | NO | -| email | string | GET | Search email to match against users | N/A | NO | -| handle | string | GET | Search handle to match against users | N/A | NO | -| kind | types.UserKind | GET | Kind (normal, bot) | N/A | NO | -| incDeleted | bool | GET | [Deprecated] Include deleted users (requires 'access' permission) | N/A | NO | -| incSuspended | bool | GET | [Deprecated] Include suspended users | N/A | NO | -| deleted | uint | GET | Exclude (0, default), include (1) or return only (2) deleted users | N/A | NO | -| suspended | uint | GET | Exclude (0, default), include (1) or return only (2) suspended users | N/A | NO | -| limit | uint | GET | Limit | N/A | NO | -| offset | uint | GET | Offset | N/A | NO | -| page | uint | GET | Page number (1-based) | N/A | NO | -| perPage | uint | GET | Returned items per page (default 50) | N/A | NO | -| sort | string | GET | Sort items | N/A | NO | - -## Create user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| email | string | POST | Email | N/A | YES | -| name | string | POST | Name | N/A | NO | -| handle | string | POST | Handle | N/A | NO | -| kind | types.UserKind | POST | Kind (normal, bot) | N/A | NO | - -## Update user details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}` | HTTP/S | PUT | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | uint64 | PATH | User ID | N/A | YES | -| email | string | POST | Email | N/A | YES | -| name | string | POST | Name | N/A | YES | -| handle | string | POST | Handle | N/A | NO | -| kind | types.UserKind | POST | Kind (normal, bot) | N/A | NO | - -## Read user details - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | uint64 | PATH | User ID | N/A | YES | - -## Remove user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | uint64 | PATH | User ID | N/A | YES | - -## Suspend user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}/suspend` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | uint64 | PATH | User ID | N/A | YES | - -## Unsuspend user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}/unsuspend` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | uint64 | PATH | User ID | N/A | YES | - -## Undelete user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}/undelete` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | uint64 | PATH | User ID | N/A | YES | - -## Set's or changes user's password - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}/password` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | uint64 | PATH | User ID | N/A | YES | -| password | string | POST | New password | N/A | YES | - -## Add member to a role - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}/membership` | HTTP/S | GET | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | uint64 | PATH | User ID | N/A | YES | - -## Add role to a user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}/membership/{roleID}` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | -| userID | uint64 | PATH | User ID | N/A | YES | - -## Remove role from a user - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}/membership/{roleID}` | HTTP/S | DELETE | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| roleID | uint64 | PATH | Role ID | N/A | YES | -| userID | uint64 | PATH | User ID | N/A | YES | - -## Fire system:user trigger - -#### Method - -| URI | Protocol | Method | Authentication | -| --- | -------- | ------ | -------------- | -| `/users/{userID}/trigger` | HTTP/S | POST | Client ID, Session ID | - -#### Request parameters - -| Parameter | Type | Method | Description | Default | Required? | -| --------- | ---- | ------ | ----------- | ------- | --------- | -| userID | uint64 | PATH | ID | N/A | YES | -| script | string | POST | Script to execute | N/A | YES | - ---- \ No newline at end of file diff --git a/pkg/api/docs.go b/pkg/api/docs.go new file mode 100644 index 000000000..e2fe0ceb0 --- /dev/null +++ b/pkg/api/docs.go @@ -0,0 +1,18 @@ +package api + +import ( + "fmt" + "github.com/cortezaproject/corteza-server/docs" + "github.com/goware/statik/fs" + "net/http" +) + +func serveDocs(w http.ResponseWriter, r *http.Request) { + root, err := fs.New(docs.Asset) + if err != nil { + http.Error(w, fmt.Sprintf("could not read embeded filesystem: %v", err.Error()), http.StatusInternalServerError) + return + } + + http.StripPrefix("/docs", http.FileServer(root)).ServeHTTP(w, r) +} diff --git a/pkg/api/server.go b/pkg/api/server.go index 0b90cb4ce..b1990df85 100644 --- a/pkg/api/server.go +++ b/pkg/api/server.go @@ -145,4 +145,7 @@ func (s server) bindMiscRoutes(router chi.Router) { if s.httpOpt.EnableHealthcheckRoute { router.Get("/healthcheck", healthcheck.HttpHandler()) } + + //router.Group(serveDocs2) + router.HandleFunc("/docs*", serveDocs) }