Categorygithub.com/konstellation-io/kai-processes/rest-trigger
modulepackage
1.0.0
Repository: https://github.com/konstellation-io/kai-processes.git
Documentation: pkg.go.dev

# README

REST trigger

The REST webhook trigger is a predefined KAI process that creates a REST server instance.
It will stay listening for client requests through port 8080.

How to setup

There is an optional "path" configuration for users to specify the path in which the REST service will be deployed. If no "path" is setup, the trigger will be in the default "trigger" path.

Processes communicating with this trigger must be prepared to do so. Processes listening to the REST trigger need to unmmarshal protobuf based JSON messages, and processes sending messages to the trigger need to marshal protobuf based JSON messages.

Both output and input messages towards this process require the usage of specific keys in the JSON.

Configuration

The configuration should be defined inside the centralized configuration scope:

KeyOptionalTypeValue
pathyesstrWhere the REST service will be deployed ("trigger" by default).

Configuration Example

centralized_configuration:
  process:
    config:
      path: 'mypath'

Trigger's Output (JSON)

KeyTypeValue
methodstrThe REST method used
body[]byteOptional. For POST and PUT methods the body is taken from the request's body

Trigger's Output Example

{
 "method": "POST",
 "body": {"keyA": "valueA", "keyB": "valueB"},
}

Trigger's Input from other processes (JSON)

KeyTypeValue
status_codestrStatus code for the workflow execution, used later in http server response
messagestrA message sent by the user

Trigger's Input Example

{
 "status_code": "200",
 "message": "All good!",
}

Trigger's Output to client (JSON)

KeyTypeValue
messagestrA message

Trigger's Output to client

{
 "message": "All good!",
}