URLSW: Url Port Switch - Control API
Control Calls
Disabling output terminals
There are two separate formats of the disable control call depending on how the output terminal is identified:
- the output terminal is specified by name:
out1 - out8
- the output terminal is specified by the IP address of the backend web server
Request: /api/disable?channel=out3 (disables the output terminal out3)
Request: /api/disable?10.11.12.13 (disables the output terminal that is connected to the web server with the IP address 10.11.12.13)
Response:
URLSW returns the following structure with a status code and optional status message:
{
"status" :
{
"code": code_value,
"message": "status_message"
}
}
Possible status code values include:
| Code value | Description |
0 | Operation was successful; terminal was disabled. |
10 | Operation was not successful; HALB configuration was not modified. The most probable causes are that the terminal is already disabled or that the specified IP address is invalid. |
100 | An error occured while processing the request; more details are available in the status message. |
Enabling output terminals
There are two separate formats of the enable control call depending on how the output terminal is identified:
- the output terminal is specified by name:
out1 - out8
- the output terminal is specified by the IP address of the backend web server
Request: /api/enable?channel=out3 (enables the output terminal out3)
Request: /api/enable?10.11.12.13 (enables the output terminal that is connected to the web server with IP address 10.11.12.13)
Response:
URLSW returns the following structure with a status code and optional status message:
{
"status" :
{
"code": code_value,
"message": "status_message"
}
}
Possible status code values include:
| Code value | Description |
0 | Operation was successful; terminal was enabled. |
10 | Operation was not successful; URLSW configuration was not modified. The most probable causes are that the terminal is already enabled or that the specified IP address is invalid. |
100 | An error occured while processing the request; more details are available in the status message. |
Retrieving output terminal state
Request: /api/status (returns the state of all output terminals)
Response:
URLSW returns the following structure with a status code and optional status message:
{
"status" :
{
"code": code_value,
"message": "status_message",
"terminal_id": "terminal_state",
"terminal_id": "terminal_state",
...
}
}
State is returned only for connected terminals; state for disabled and disconnected terminals is not reported.
Possible status code values are listed below:
| Code value | Description |
0 | Operation was successful. |
100 | An error occured while processing the request; more details are available in the status message. |
Possible terminal values are out1 - out8.
Possible state values are:
| State value | Description |
up | Terminal is connected and active. |
down | Terminal is inactive. The web server that is connected to this terminal it is either down or failed the URLSW health check. |
An example state output:
{
"status" :
{
"code": 0,
"message": "",
"out1": "up",
"out2": "up",
"out3": "down",
"out4": "up"
}
}
Getting output terminals regexp list
Request: /api/regexp_getlist?channel=out3 (returns the state of out3 output terminal)
Response:
URLSW returns the following structure with a status code and optional status message:
{
"status" :
{
"code": code_value,
"message": "status_message"
"data":
{
"ulr_regexps":
{
"regexp1": "regexp1 value",
"regexp2": "regexp2 value",
"regexp3": "regexp3 value",
...
}
"header_regexps":
{
"regexp1": "regexp1 value",
"regexp2": "regexp2 value",
"regexp3": "regexp3 value",
...
}
}
}
}
Possible status code values include:
| Code value | Description |
0 | Operation was successful. |
100 | An error occured while processing the request; more details are available in the status message. |
An example output:
{
"status" :
{
"code": 0,
"message": ""
"data":
{
"ulr_regexps":
{
"regexp1": "user=",
"regexp2": "showcat"
}
"header_regexps":
{
"regexp1": "^Host: www\."
}
}
}
}
Adding new regexp to output terminal regexp list
Request: /api/regexp_add?channel=out3&type=url®exp=login (new regexp "login" will be added to the out3 output terminal url regexp list)
Response:
URLSW returns the following structure with a status code and optional status message:
{
"status" :
{
"code": code_value,
"message": "status_message"
}
}
Possible status code values include:
| Code value | Description |
0 | Operation was successful; regular expression was added. |
10 | Operation was not successful; URLSW configuration was not modified. |
100 | An error occured while processing the request; more details are available in the status message. |
Removing regexp from output terminal regexp list
Request: /api/regexp_delete?channel=out3&type=url®exp=login (regexp "login" will be deleted from the out3 output terminal url regexp list, if it exists)
Response:
URLSW returns the following structure with a status code and optional status message:
{
"status" :
{
"code": code_value,
"message": "status_message"
}
}
Possible status code values include:
| Code value | Description |
0 | Operation was successful; regular expression was added. |
10 | Operation was not successful; URLSW configuration was not modified. |
100 | An error occured while processing the request; more details are available in the status message. |
Clearing output terminal regexp list
Request: /api/regexp_clear?channel=out3 ( clears url regexp list and header regexp list for out3 output terminal )
Response:
URLSW returns the following structure with a status code and optional status message:
{
"status" :
{
"code": code_value,
"message": "status_message"
}
}
Possible status code values include:
| Code value | Description |
0 | Operation was successful; regular expression was added. |
100 | An error occured while processing the request; more details are available in the status message. |
-- Main.AndriyMayevskyy - 30 Jan 2009