Skip to main content
Version: 13.x (Current)

Overview

This template is meant to be the starting point to build a new typescript project to interact with Modefinance APIs.

Endpoints

The endpoints exposed are designed to be compatible with either Kafka or REST flow manager service, that means the responses are asynchronous.

The following events are sent by default by the service:

  • actionCompleted
  • actionError

POST /s-peek-extended

With this endpoint the service calls Modefinance S-Peek Extended API and proxies the response to the flow manager router service defined in the ROUTER_URL environment variable as follow:

Request

{
"key": { "type": "string" },
"value": {
"type": "object",
"properties": {
"messageLabel": "actionCompleted",
"messagePayload": {
"mainFlowId": { "type": "string" },
"fiscalCode": { "type": "string" },
}
}
}
}

Response

{
"key": { "type": "string" },
"value": {
"type": "object",
"properties": {
"messageLabel": "actionCompleted",
"messagePayload": {
"mainFlowId": { "type": "string" },
"scores": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": { "type": "string" },
"value": { "type": "number" },
"result": { "type": "string" },
"timestamp": { "type": "string" },
"origin": { "type": "string" },
"metadata": { "type": "object" },
}
}
}
}
}
}
}

This could be enabled through REST POST /s-peek-extended endpoint or Kafka consumer, data to Router is sent using the same mode.

Errors

If an error occurs the following response will be sent:

{
"key": { "type": "string" },
"value": {
"type": "object",
"properties": {
"messageLabel": "actionError",
"messagePayload": {
"error": { "type": "string" },
}
}
}
}