REST Route

Parameters for REST API Routes

Parameter nameDescriptionDefault
Rest Server NameThe base address of the HTTP endpoint

n.b. please do not insert http:// or https:// here; use the Rest Schema parameter
127.0.0.1
Rest Server PortThe port of the HTTP endpoint8080
Rest SchemaSchema to allow to distinguish between a plain or a secured connection.

Allowed values:
- http
- https
https
Authentication TypeHTTP Server authentication type.

Allowed values:
- Basic
- none
Basic
Authentication ParametersAuthentication specific parameters. For example for the Basic authentication this field should contain the credentials in the format 'user:password'empty
Rest ActionThe HTTP verb for the REST call

Allowed values:
- GET
- POST
POST
Rest Header PropertyHeader property name in the Camel message where Camel Rest component will find the composed URL representing the endpoint to invoke.
For most of the use cases the default configuration works good and should not to be changed
evaluatedRestEndPoint
Rest Original TopicThe name of the topic where the message was originally sent to by the device. By default it is read from the originalTopic property of the Camel message.
For most of the use cases the default configuration works good and should not to be changed
$simple{in.header.originalTopic}
Rest Message ConverterMessage converter to convert the incoming message before forwarding it to the REST endpoint

Allowed values:
- none: no message converter will be used so the message forwarded to the Rest endpoint will be the same received by the broker
- json: the incoming message will be converted to a Kura payload then to JSON (see 1)
json
Rest Message Converter ConfigurationAdditional configuration that may be required by the message converter. The value of this parameter is converter-specific. The basic json converter does not require any additional configuration.empty
Rest Url OptionAdditional options to append to the Rest call urlempty
Rest Topic MatchingDescribes how to map the incoming messages topics to Rest resource (see 2).
The field expects a list of rows composed by comma separated key value pair.
The key is the regex to match the incoming topics.
The value is the corresponding Rest resource.
The destination resource can contain variables recognized by the routing service (currently only ACCOUNT variable is supported).
The default value maps all the incoming topics into the ${ACCOUNT} (account name) URL.
.*,${ACCOUNT}

1) Output Json example

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "scopeId": "AQ",
  "deviceId": "RyO9_XKGRsw",
  "clientId": "client-id-0",
  "receivedOn": 1543486113,
  "sentOn": 1543486113,
  "capturedOn": 1543486113,
  "position": {
    "longitude": 0.0,
    "latitude": 0.0,
    "precision": 50,
    "heading": 240,
    "speed": 110,
    "timestamp": 1543486113,
    "satellites": 2,
    "status": 0
  },
  "channel": {
    "semanticParts": [ "one", "two", "three" ]
  },
  "payload": {
    "metrics": {
      "metric_one": {
        "value": "string_value",
        "valueType": "string"
      },
      "metric_two": {
        "value": 123,
        "valueType": "integer"
      },
      "metric_three": {
        "value": true,
        "valueType": "boolean"
      }
    },
    "body": "VGhpcyBpcyBhIGJvZHkgY29udGVudA=="
  }
}

2) Topic matching example
This is a topic matching example.
Please note that the incoming message use the JMS syntax (so the topic levels are . sepated instead of / separated)

(.*\.){2}topic1\.topic1_1,rest_path_1
(.*\.){2}topic2,rest_path_2
(.*\.){2}topic3\.topic3_1,rest_path_3

This configuration forwards the messages for all the account's clients to different destination topics depending on 3 semantic topics:

MQTT semantic topicHTTP Endpoint
topic1/topic1_1/rest_path_1
topic2/rest_path_2
topic3/topic3_1/rest_path_3