Web Request Common Block
Contents
- 1 Web Request Common Block
- 1.1 Name Property
- 1.2 Block Notes Property
- 1.3 Exceptions Property
- 1.4 Request Method Property
- 1.5 Uri Property
- 1.6 Condition Property
- 1.7 Logging Details Property
- 1.8 Log Level Property
- 1.9 Enable Status Property
- 1.10 Authentication Type Property
- 1.11 Encoding Type Property
- 1.12 Input Parameters Property
- 1.13 JSON Content Property
- 1.14 Timeout Property
- 1.15 Custom HTTP Headers Property
- 1.16 Login Name Property
- 1.17 Password Property
- 1.18 Result Property
The Web Request block is used for both routing and voice applications. Use to invoke any supported HTTP web request or REST-style web Service.
- It supports PUT, DELETE, GET and POST methods over HTTPS.
- It is based on common Web Services standards such as XML, SOAP and WSDL instead of proprietary standards that are currently being replaced.
REpresentational State Transfer (REST) is an XML-based protocol for invoking Web Services over HTTP. REST is a lighter version of SOAP, which has evolved into a more complex protocol. REST-style web services offer a less coupled paradigm whereby simpler requests and responses are used. As an example, a simple HTTP request follows the REST methodology. The Web Request block allows the user to query "RESTful" Web services. The supported return formats for the Web Request block are:
- plain text
Note: For workflows, the result will be returned in a JSON string with key name result, e.g., {"result":"This is a plain text result"}
- plain XML
- JSON string (See an issue pertaining to JSON objects in Troubleshooting.)
The Web Request block has the following properties:
Name Property
Find this property's details under Common Properties for Workflow Blocks or Common Properties for Callflow Blocks
Block Notes Property
Find this property's details under Common Properties for Workflow Blocks or Common Properties for Callflow Blocks.
Exceptions Property
Find this property's details under Common Properties for Workflow Blocks or Common Properties for Callflow Blocks You can also define custom events.
Request Method Property
This property Indicates the method for invoking the web request:
- get--Invoked using HTTP Get
- post--Invoked using HTTP Post. This option is valid only when the parameters are passed as a namelist (Use Namelist property is set to true). This is generally used when a large amount of data needs to be sent as an input value for a subdialog.
- put--Invoked using HTTP Put
- delete--Invoked using HTTP Delete
To select a value for the Request Method property:
- Select the Request Method row in the block's property table.
- In the Value field, select get, post, put, or delete from the drop-down list.
Uri Property
The Uri property specifies the http:// page to invoke. To set a URL destination for the Uri property:
- Select the Uri row in the block's property table.
- In the Value field, click the down arrow and select the variable that contains URL.
Condition Property
Find this property's details under Common Properties for Callflow Blocks or Common Properties for Workflow Blocks.
Logging Details Property
Find this property's details under Common Properties for Callflow Blocks or Common Properties for Workflow Blocks.
Log Level Property
Find this property's details under Common Properties for Callflow Blocks or Common Properties for Workflow Blocks.
Enable Status Property
Find this property's details under Common Properties for Callflow Blocks or Common Properties for Workflow Blocks.
Authentication Type Property
The Authentication Type property specifies whether to use an anonymous or basic authentication for the web request. To assign a value to the Authentication Type property:
- Select the Authentication Type row in the block's property table.
- In the Value field, select anonymous (default) or basic from the drop-down list. With the anonymous type of access, no user name/password is passed to Web service for client authentication in order to get data. If you select the basic type of access, you must supply the Login Name and Password properties.
Encoding Type Property
The Encoding Type property (used for callflows only) indicates the media encoding type of the submitted document. GVP 8.1 supports two encoding types:
- application/x-www-form-urlencoded
- multipart/form-data
To select a value for the Encoding Type property:
- Select the Encoding Type row in the block's property table.
- In the Value field, select one of the following:
- application/x-www-form-urlencoded (default)
- application/json
Input Parameters Property
Use the Input Parameters property to specify a list of required Name/Value pairs to pass as parameters to the http:// page. To specify input parameters:
- Click the Parameters row in the block's property table.
- Click the button to open the Parameter Settings dialog box.
Add Button Use the Add button to enter parameter details.
- Click Add to add an entry to Web Request Parameters.
- In the Parameter Name field, accept the default name or change it.
- From the Parameter Type drop-down list, select In, Out, or InOut:
In | Input parameters are variables submitted to the web request. |
Out | Output parameters are variables that the web request returns and will be reassigned back to the current callflow/workflow. |
InOut | InOut parameters are parameters that act as both input and output. |
- In the Expression drop-down list, select from among the variables shown, type your own expression, or click the button to use Skill Expression Builder.
- In the Definition field, type a description for this parameter.
- Click Add again to enter another parameter, or click OK to finish.
Delete Button To delete a parameter:
- Select an entry from the list.
- Click Delete.
JSON Content Property
If the HTTP request to be invoked expects JSON content, this property can be used to specify that input. It expects a variable whose content will be sent to the API specified in the HTTP URI property of the block. Set the Encoding Type property of the block to application/json. In this case, the Input Parameters property will not be used.
The variable selected in this property should contain a JavaScript object. The object can be built from a JSON string, or using the ECMAScript block.
For example, if you would like to pass a JSON content to the HTTP URI, using a variable named "content", the variable can be initialized in the following ways:
- If you have a JSON string, you can use the Assign block to assign the following value to "content":
JSON.parse('{"abc": "def", "xyz": 3}')
- Alternately, you can build a JavaScript object using an ECMAScript block with code like the following:
var content = new Object(); content['abc'] = 'def'; content['xyz'] = 3;
In both cases, set the JSON Content property of the Web Request block to the variable named "content".
Timeout Property
Select the variable containing the number of seconds that the application will wait when fetching the result of the Web Service or the Web Request. If the requested resource does not respond in that time, then a timeout event will occur.
Custom HTTP Headers Property
Use this property to add Custom headers to be sent along with the HTTP request during the runtime execution of the Server Side block.
- Click the row in the block's property table.
- Click the button to open the Custom HTTP Headers dialog box.
- Click Add to open Configuration Custom HTTP Headers dialog box.
- Select a Header type.
- Select Literal or Variable.
- Type the literal value or select the variable that contains the value.
Login Name Property
Used when Authentication type = basic. The Login Name property specifies the login name for the invoked web page. To provide a login name for the web request:
- Select the Login Name row in the block's property table.
- In the Value field, type a valid login name.
Password Property
Used when Authentication type = basic. The Password property specifies the password for the invoked web page. To provide a password for the web request:
- Select the Password row in the block's property table.
- In the Value field, type a valid password that corresponds to the login name above.
Result Property
The Result property is the variable used to get back a result from the web request. To select a variable:
- Select the Result row in the block's property table.
- In the Value field, select one of the available variables from the drop-down list. Does not need to match the variable name that is coming back as a result of the web request.