Echo API
#
DescriptionThe Echo API is a simple API that returns the data sent to the server.
There are several uses for Echo API,
- such as formatting the response/requests when used on chains,
- input validations,
- placeholder APIs
- Multi- API Aggregation on Chains
#
UIAccess the DataTrucker URL via a browser
- Go to Util API in the Sidebar > Echo API
- Fill the form to create the API
- Resource Name: an arbitrary name to identify the resource
- Method: The type of REST Call
- Validation Regex of Input values is the input sanitization before executing the command. Arguments will be sent to API as an Array and will be space-separated. Every input argument needs to pass the regex as defined during the creation of the API.
- Documentation for Validation
#
As a CRD in Openshift / KubernetesFor credentials use the the API below to the management end point
---apiVersion: datatrucker.datatrucker.io/v1kind: DatatruckerFlowmetadata: name: datatruckerflow-samplespec: Resources: requests: memory: "256Mi" cpu: "250m" limits: memory: "256Mi" cpu: "500m" JobDefinitions: - resourcename: echo1 name: echo1 tenant: Admin type: Util-Echo restmethod: GET validations: type: object properties: voila: type: string enum: - 'true' - 'false' Keys: configmap: placeholder Scripts: configmap: placeholder Type: Job DatatruckerConfig: datatruckerconfig-sample Replicas: 1 API: name: api Image: repository: docker.io imageName: datatruckerio/datatrucker-api tagName: latest
#
API############################### create a Echo API#############################
URL: /api/v1/resourcesTYPE: POSTHEADER: Authorization: "Bearer <JWT Token>"BODY (JSON): { "resourcename": "echo1", "type": "Util-Echo", "restmethod": "GET", "validations":{ "type": "object", "properties": { "voila": { "type": "string", "enum": ["true","false"] } } }}
Response: 201 OK