HTTP service node

HTTP service nodes can be used to visit a third party HTTP service and extract values from the JSON result returned from the service. In order to use HTTP service node, there are two steps involved: first, registering an HTTP service, which contains the URL, methods, params and values that need to be extracted. Second, reference that service by using HTTP service nodes while test data can be used without visiting the service.

Registering service

Click setting button in graph editing page:

Click add service in setting page

Add HTTP service content in pop up window

The HTTP service info page contains below info:

  • Service name
  • Service status (if status set on, this service can be referenced, otherwise, it cannot)
  • Interface:
    • Method(GET, POST or PUT)
    • URL
  • Input Params:
    • Header
    • Params
    • Body (only JSON format supported)
  • Return parameters (extract values from JSON format result returned from HTTP service). For example, the JSON result returned from service like below:
{
"coord": {
"lon": -0.13,
"lat": 51.51
},
"weather": [
{
"id": 300,
"main": "Drizzle",
"description": "light intensity drizzle",
"icon": "09d"
}
],
"base": "stations",
"main": {
"temp": 280.32,
"pressure": 1012,
"humidity": 81,
"temp_min": 279.15,
"temp_max": 281.15
},
"visibility": 10000,
"wind": {
"speed": 4.1,
"deg": 80
},
"clouds": {
"all": 90
},
"dt": 1485789600,
"sys": {
"type": 1,
"id": 5091,
"message": 0.0103,
"country": "GB",
"sunrise": 1485762037,
"sunset": 1485794875
},
"id": 2643743,
"name": "London",
"cod": 200
}
Return param namevaluenote
temp$.main.tempThe temperature of the location
pressure$.main.pressureThe pressure of the location
speed$.wind.speedThe wind speed of the location
lat$.coord.latThe latitude of the location

JsonPath is used as the extract semantics and its detail info can be checked below:https://github.com/json-path/JsonPath

HTTP service node

The service registered in the first step can be referenced in HTTP service nodes.

1.2.1 Add an HTTP service node

1.2.2 Reference an HTTP service in HTTP service node

Test dialog

When the user inputs “London, UK”, the bot gets London’s temperature.