Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
This page is for a data modeller who needs to load data from an external source via HTTP.
Overview
An HTTP collector reads data from a HTTP Datasource. The collector defines how the data needed from the datasource is extracted to be used in PhixFlow.
To add a new HTTP collector to an analysis model:
Go to the model's toolbar → Create group.
Click
to expand the menu.Insert excerpt _http _http nopanel true Drag a
onto the analysis model.Insert excerpt _http_collector _http_collector nopanel true
To add an existing HTTP collector to an analysis model, in the model diagram toolbar:
Go to the model toolbar → List group.
Click
to expand the menu.Insert excerpt _http _http nopanel true Click
to open the list of available collectors.Insert excerpt _http_collector _http_collector nopanel true Drag an HTTP collector into the analysis model.
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Table Values in a HTTP Collector
To drive the lookups made by a HTTP collector from a table, the two must be connected using a lookup pipe. For example, a URL for a server can either be captured or calculated in an attribute called "ServerURL". The URL is then passed via a lookup pike to the HTTP collector to be used in its URL Expression.
If the pipe is called in
, here is how the URL Expression would be written on the HTTP collector: {substring(in.ServerUrl,9)}
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Basic Settings
Field | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
Name | Enter the name of the HTTP collector. | ||||||||
Enabled |
|
Send Message
Define details of the HTTP request sent to the HTTP Datasource to get the data required.
Field | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
HTTP Request Method |
| ||||||||||||||||||||
URL Expression |
The HTTP collector follows any HTTP redirections and returns the final response. | ||||||||||||||||||||
Statement Expression | An expression to generate the data that will be sent by the collector to the datasource. Example XML Statement
Example JSON Statement
See also HTTP datasource instance and Expressions and PhixScripts. |
HTTP Headers
This section has a toolbar with standard buttons. The grid contains a list of the HTTP headers defined for this collector. To add a HTTP header to the list, click
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Some headers will be set to default values if not provided. Automatically added headers may not appear in the debug log. The Content-Length header will be added to all requests and cannot be overridden by providing a value.
Response
Define the data response type/format that will be returned:
HTML: response type allows an XPath Expression to be specified in order to retrieve just specified sections of the data into XML structures.
XML: response type allows an XPath Expression to be specified in order to retrieve just specified sections of the data into XML structures. XML response types also support XML namespaces. The Xml Namspaces tab will be available when this response type is chosen.
String: response type will return the full data as a string value.
Please see Response Examples for how the returned data can be used and evaluated in the corresponding attribute expressions.
Field | Description | ||
---|---|---|---|
Return Type | Select the type of the expected response:
| ||
XPath or JsonPath | Available when Return Type is XML, HTTP or JSON. The expression used to resolve or filter the data that comes back in the selected format.
|
XML Namespaces
Available when Return Type is XML or HTTP. This section has a toolbar with standard buttons. The grid contains a list of the namespaces defined in an XML response.
To add a namespace to the list, click
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Advanced
Field | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
HTTP Datasource | Select the HTTP datasource that this collector will collect from. For how to add a new one, see HTTP Datasource. To select from a list, click
| ||||||||||
Datasource Instance Expression | The datasource to which this collector is connected may list multiple instances from which the data may be accessed. Each HTTP datasource instance is identified by a unique string. This expression should evaluate to a string which allows the collector to determine the specific instance to use. If the expression is blank then the collector will assume that there is only one instance and will use that one by default. If there is more than one instance and no expression is provided here then an error will be thrown during analysis since the collector will be unable to determine which source to use. See also HTTP datasource instance and Expressions and PhixScripts. | ||||||||||
Timeout (secs) | The number of seconds to wait for a response from the corresponding HTTP datasource before a timeout is recorded. | ||||||||||
Icon | Enter the path for an image file that has been uploaded to the PhixFlow database. PhixFlow displays this icon in controls when the HTTP collector is used. | ||||||||||
Allow Non-Scheduled Collection |
| ||||||||||
Log Traffic |
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
This example uses the following example data.
XML Data
Standard
Code Block | ||
---|---|---|
| ||
<root> <main page="PF Main Page"> <title name="PF Title">PF Title Text"> <datarow> <data initials="AA">Alistair Andrews<data> <data initials="BB">Bert Brown</data> </datarow> </title> </main> </root> |
With Namespace
Code Block | ||
---|---|---|
| ||
<root xmlns:h="http://example.com/schema"> <main page="PF Main Page"> <h:title name="PF Title">PF Title Text"> <h:datarow> <h:data h:initials="AA">Alistair Andrews<data> <h:data h:initials="BB">Bert Brown</data> </h:datarow> </h:title> </main> </root> |
HTML Data
Code Block | ||
---|---|---|
| ||
<html> <body nodename="Html Body"> <table> <tbody> <tr> <td initials="AA">Alistair Andrews</td> <td initials="BB">Bert Brown</td> </tr> </tbody> </table> </body> </html> |
JSON
Code Block | ||
---|---|---|
| ||
{ "main_page": { "page": "PF Main Page", "title" : { "name" : "PF Title Text, "data" : [ {"initials": "AA", "value" : "Alistair Andrews"}, {"initials": "BB", "value" : "Bert Brown"} ] } } } |
The data is being pointed to by either HTTP datasources or XML/HTML File collectors respectively.
The following table shows the different types of responses that can be returned from an HTTP Collector and how these can be used in the corresponding attribute expressions. A HTTP Collector response type of XML/HTML will mimic the responses from XML/HTML Collectors respectively.
Response Type | Path Expression | Explanation | ||
---|---|---|---|---|
String | n/a | A String response should be referenced in the attribute expressions as in.value Note that in.value will contain the complete string data referenced above. | ||
XML |
| This path expression will bring back all elements matching the xpath expression including the parent/grandparents and all child elements/subelements. The following examples show how to reference the returned xpaths html/xml data structure in attribute expressions:-
Note the use of
Namespaces XML documents containing namespaces are supported.
| ||
HTML |
| This Path expression will bring back all elements matching the xpath expression including the parent/grandparents and all child elements/subelements. The following examples show how to reference the returned xpaths html/xml data structure in attribute expressions:-
Note the use of:
| ||
JSON | $.main_page.title | This path expression will bring back all elements matching the jsonpath expression including the parent/grandparents and all child elements/subelements. The following examples show how to reference the returned jsonpath html/xml data structure in attribute expressions:-
Note the use of:
|
Live Search | ||||||||
---|---|---|---|---|---|---|---|---|
|
Panel | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
|
Learn More
For links to all pages in this topic, see Analysis Models for Batch Processing Data.
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|