The Send HTTP request Task, when applied, will send a REST request to a web service.
This task essentially:
The following functions exist to help with the creation and processing of the HTTP Request.
Property Name | Description |
---|---|
Request URL | The URL where the web request should be sent.
|
Request Verb | The resource action to perform.
The task will accept any valid request verb; the most common being:
This defaults to GET when the Task is added. |
Request Headers (optional) | A pipe delimited list of headers to be sent with the request.
|
Request Body (optional) | The HTTP request body.
Request Body cannot be set with a GET or HEAD request; therefore anything entered in
this field when these Verbs are set will be omitted from the request. |
Response Body Constant Name (optional) | The name of the constant to drive the response body to.
When provided with the name of a constant, the task will drive the body of the
response received from the REST service to it. This will enable users to process the response to retrieve
requested data. |
Response Header Constant Name (optional) | The name of the constant to drive the response headers to.
When provided with the name of a constant, the task will drive the headers of the
response received from the REST service to it. This will enable users to process the response to retrieve
requested data. |
Title | Changes the Title (not the name) of the task. |
This task has different types of Outputs. For more information about Outputs see Specification Macros Task Node.
Output Name | Description |
---|---|
Response Body | The Body of the response |
Response Headers | The Headers of the response |
This task supports Status Outputs. These can be used to perform different actions depending on what the status outcome of the task is. For more information see Status Outputs in the Task Node Outputs section of Specification Macros Task Node.
The status output navigation is as follows:
Success
Success with Warnings
Failed (one of the following occurred)
When this task is added the properties are static by default.
See How To: Change A
Static Property To A Dynamic Property to enable rules to be built on these properties.
Property Name | Example Rule | Example Result | Meaning |
---|---|---|---|
Request URL | http://www.driveworks.co.uk/ | http://www.driveworks.co.uk/ | The website you are requesting data from. |
Request Verb | "Post" | Post | Used to send Data to an external source. |
Request Verb | "Get" | Get | Used to Retrieve Data from an external source. |
Request Verb | "Put" | Put | Used to Update Data. |
Request Verb | "Delete" | Delete | Used to Delete Data. |
Request Header | DWVariableOAuthReqHeader | DWVariableOAuthReqHeader | Headers being sent with the request. |
Request Body | DWVariableOAuthReqBody | DWVariableOAuthReqBody | The HTTP request body. |
Response Body Constant Name | DWConstantResponseBody | DWConstantResponseBody | The name of the constant to drive the response body to. |
Response Header constant Name | DWConstantResponseHeader | DWConstantResponseHeader | The name of the constant to drive the response header to. |
The Output results for the example would be:
Output Name | Output Value |
---|---|
Response Body | This will be the data requested and will usually be formatted as XML or JSON. This is the same data sent to the Constant if one is specified. |
Response Headers | This will usually be formatted as XML or JSON and contains information about how to format the Body. This is the same data sent to the Constant if one is specified. |
This is to show a practical example of how to use this Task to request information from Google Maps. The set up is available to download with other examples as a Tech Tip.
Property | Rule |
---|---|
Request URL | "https://maps.googleapis.com/maps/api/distancematrix/xml?origins="& StartingPointReturn&"&destinations=" & DestinationReturn & "&mode="&MethodOfTransportReturn & "&units="&UnitsReturn |
Request Verb | "GET" |
This table shows the data that comes back from this request. This can be directly put into another task using the Data Outputs.
Output Name | Value |
---|---|
Response Body | <?xml version="1.0" encoding="UTF-8"?> <DistanceMatrixResponse> <status>OK</status> <origin_address>Leeds, UK</<origin_address> <destination_address>Manchester, UK</destination_address> <row> <element> <status>OK</status> <duration> <value>4023</value> <text>1 hour 7 mins</text> </duration> <distance> <value>71829</value> <text>44.6 mi</text> </<distance> </element> </row> </DistanceMatrixResponse> |
Response Headers | {"X-XSS-Protection","1; mode=block";"X-Frame-Options","SAMEORIGIN";"Alt-Svc","hq=":443""; ma=2592000; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="42,41,39,35"";"Vary","Accept-Language, Accept-Encoding";"Transfer-Encoding","chunked";"Accept-Ranges","none";"Cache-Control","public, max-age=86400";"Content-Type","application/xml; charset=UTF-8";"Date","Fri, 30 Mar 2018 10:16:12 GMT";"Expires","Sat, 31 Mar 2018 10:16:12 GMT";"Server","mafe";} |
This task has different types of Outputs. For more information about Outputs see Specification Macros Task Node.
Outputs are only available within Specification Macros. Currently Outputs are not available for Specification Flow.
See Also
How To: Create the Data for a Web Service to Communicate with DriveWorks Autopilot
DriveWorks Tech Tips Portal |
Send HTTP Request Look at how to request data from a web service using the HTTP Request task in DriveWorks. You can also look at how to retrieve data from the result using Xpath. |
DriveWorks Tech Tips Portal is available to DriveWorks Pro customers with an active subscription and support contract. Tech Tips provide cut down projects that highlight specific functionality for faster and more effective learning. To access the portal:
The portal provides a search facility, start typing the name of the Tech Tip (as indicated above) to display the Tip you require. |