Allows you to create special request, that can be called using API (from BellaDati or external application). HTTP, MQTT, FTP or SSH request types are supported.

Available since BellaDati 2.9.19


CREATE NEW REQUEST CONFIGURATION

To create  new Request configuration

  1. Navigate to Administration page
  2. At the System administration block, navigate to the Request configuration page
  3. Click the button CREATE. Window with settings will appear
  4. Select Name of your request
  5. (Optional) Set Tags for for your Requests.
    Tags are used to specify XML backup import/export. See Domain Backup for more information

There are several Request type to choose. Each of them require different JSON configuration.


Configuration JSON    


Configuration JSON defines settings of your request. Variables ca be also used to define configuration. See bellow how to use and pass variables

HTTP_REQUEST
{
   "url":"https://testyour_request.com/request",
   "ssl":true,
   "methodType":"GET",
   "contentType":"application/json",
   "headers":[
      {
         "name":"name_of_header",
         "value":"value_of_header"
      }
   ]
}
Possible values

methodType: GET | POST

MQTT_REQUEST
{
	"host": "your.mqtt.broker.com",
	"port": 1883,
	"ssl": false,
	"qos": "AT_LEAST_ONCE",
	"topic": "topic_name",
	"retain": true
}
Possible values

qos: AT_LEAST_ONCE | EXACTLY_ONCE | AT_MOST_ONCE

FTP_DOWNLOAD
{
   "host":"localhost",
   "port":8088,
   "ssl":false,
   "path":"folder",
   "filename":"filename.txt",
   "username":"username",
   "password":"usernamesPassword",
   "passiveMode":false,
   "controlKeepAliveReplyTimeout":30000
}


FTP_UPLOAD
{
   "checksumAlgorithm":"SHA-256",
   "host":"localhost",
   "port":8088,
   "ssl":false,
   "path":"temp",
   "username":"belladati",
   "password":"520056Ananas",
   "passiveMode":false,
   "controlKeepAliveReplyTimeout":30000,
   "createDirectories":true
}
Possible values

checksumAlgorithm (optional): MD5 | SHA-256

When checksumAlgorithm is set, correct value of check sum must be sent as parrameter "checksum"

SSH_COMMAND
{
  "host": "ssh.belladati.com",
  "username": "sshuser",
  "certificate": "C:\\key\\private33.ppk",
  "password": "TDzuyNKKN/LL/SSjtJjm7A=="
}

Payload Template

You can add static payload, that will be sent with your request. Payload can also contain variables.

Static payload:

{"name":"belladati"}


Payload with variables. See bellow how to send request

{'name':"$variableName"}


Multiple payloads can be added. Those will be sent all at once. If you use Delay each payload will sent after specified delay.


SENDING REQUEST

Resource Information

Resource URL

https://service.belladati.com/api/requests

HTTP Method

POST

Request Parameters

config_id

ID or CODE of request config

12

variables

(Optional) If payload is specified in payload template and it contains variable like $variableName and $variableName2. You can set its value separated by commas

variableName=value,variableName2=value2

payload

(Optional) You can sent your own payload and ignore payload template

{"name":"belladati"}


Or you can call request config using httpRequestAsync(String CODE or ID, String payload, Map variables) function. Here is small example

def r = httpRequestAsync("DH1RDTDB", "{\"name\":\"belladati\"}", [variableName:value])
serviceResponse(r, 500, 10000) {}
Response.ok("OK","text/plain").build() 


SAVING XML BACKUP

To perform Request configurations backup:

  1. Navigate to Administration page
  2. At the System administration block, navigate to the Request configuration page
  3. Click the button Save XML Backup 
  4. XML Backup of your request configurations will be downloaded

LOADING XML BACKUP

To load Request configurations backup

  1. Navigate to Administration page
  2. At the System administration block, navigate to the Request configuration page
  3. Click the button Load XML Backup 
  4. Navigate to your XML Backup
  5. Follow the wizard to restore your backup


  • No labels