HTTP Exporter


This page is for data modellers who want to export data via HTTP.

Overview

An HTTP exporter outputs table data via a HTTP Datasource to an external web site or service, via HTTP.

To add a new HTTP exporter to an analysis model:

  1. Go to the model's toolbar → Create group.
  2. Click  HTTP to expand the menu.
  3. Drag a  HTTP Exporter onto the analysis model.

To add an existing HTTP exporter to an analysis model, in the model diagram toolbar:

  1. Go to the model toolbar → List group.
  2. Click  HTTP to expand the menu.
  3. Click  HTTP Exporter to open the list of available exporters.
  4. Drag an HTTP exporter into the analysis model.



 Handling Newlines

The way that HTTP collector, exporter and header objects handle newlines in data depends on the data type.

String, XML and HTML

HTTP objects retain all newline characters in HTTP and XML data. To strip the newlines, add the following expression to the attribute expressions that use the data from the HTTP object

.replaceAll(in.value, "[\r\n]", ""

XML

As PhixFlow cannot include newlines in an attribute value, it automatically replaces newlines in JSON with a space. If you want the data to indicate where the newlines were, in the Statement Expression, specify the escape character \n.

In the following sample of JSON, the paragraph symbol  indicates a newline character.

{
  “line1” : “Single line of text" 
  “line2” : “Also a single 
line of text” 
 “line3” : “Multiple lines of↵
 text split over↵several lines” 
}

By default a HTTP collector retrieves...

Not sure how to deal with this for Headers and Exporters....

{“line1” : “Single line of text" “line2” : “Also a single line of text”, “line3” : “Multiple lines of text split over several lines” }

in the Statement Expression, specify ??? to return a string with the newline indicated by /n.

{“line1” : “Single line of text" “line2” : “Also a single line of text”, “line3” : “Multiple lines of/ntext split over/nseveral lines” }

HTTP collectors and exporters:

  • replace newlines with spaces in JSON data. To retain newlines, see Statement Expression.
  • retain all newline characters in HTTP and XML data. To strip the newlines, add the following expression to the attribute expressions that use the data from the HTTP collector or exporter.
.replaceAll(in.value, "[\r\n]", ""

JSON data automatically replaces newlines with spaces.

Property Pane Toolbar

For information about the toolbar options, see the Common Properties page, Toolbars and Controls section.

 Properties Tab

Parent Details

If this item is within or belongs to another, its parent name is shown here. See the Parent Details section on the Common Properties page for more details.

Basic Settings

FieldDescription
NameName of the HTTP Exporter.
Enabled Tick when the configuration is complete and the HTTP exporter is ready to be used.

Send Message

Define details of the data that will be sent to the HTTP Datasource.

FieldDescription
HTTP Request MethodSelect one of the following HTTP methods to use for the request:
  • GET or POST
  • GET
  • POST
  • DELETE
  • OPTIONS
  • PUT
  • PATCH

We recommend that you select a method but if you do not, PhixFlow uses GET or POST by default. If the Send Message → Statement Expression:

  • evaluates to null or empty string, PhixFlow uses GET
  • is not empty, PhixFlow uses POST.

For information, see the w3schools page about HTTP methods.

URL Expression
The URL to be used, without the leading http:// prefix.  If this field is blank, the URL field on the HTTP Datasource Instance is used directly.

You can embed expressions in the URL by enclosing the expression in ${…}. Syntax rules depend on the response language; see Embedded Expressions.

Example

This expression adds to the base URL provided by the HTTP datasource instance:
    {_url}/sub1/sub2?param1=3

Statement Expression

An expression to generate the data that will be sent by the exporter to the datasource.

Embed expressions within a statement by enclosing the expression in ${…}. Syntax rules. see Embedded Expressions.

The statement is encoded based on the Content-Type Header settings.

  • If the Content-Type Header charset parameter is set, this is used.
  • If the Content-Type header is set, but no charset is specified, then PhixFlow uses a default character set dependent on the content type.
  • If no Content-Type Header is set, PhixFlow uses the default ISO-8859-1

&lt?xml version ="1.0"?&gt &lt!DOCTYPE CORPORATE DASHBOARD 
"corpDash.dtd"&gt &ltresults user="%USERNAME%" 
password="%PASSWORD%"&gt &ltmonthlyTotals region={'"' + Region +
 '"'} division={'"' + Division + '"'}&gt 
&lttotalBilled&gt{'"' + TotalBilled + 
'"'}&lt\totalBilled&gt &lttotalCollected&gt{'"' + 
TotalCollected + '"'}&lt\totalCollected&gt 
&ltmonthlyTotals&gt &lt\results&gt

For how to configure and use usernames and passwords for a site, see Authenticating for an API and  Secret Key and Local Secret
To reference:

  • HTTP datasource instance Username and Password properties, use the variables:  %USERNAME% and %PASSWORD%.
  • encrypted values, use  ${_datasource.key}  where key is the Name of the secret key.

See also Expressions and PhixScripts.

HTTP Headers

The grid contains a list of the HTTP headers defined for this exporter. To add a HTTP header to the list, click  Create New. PhixFlow opens a new HTTP Header properties. To remove a HTTP header, use the  Delete in the toolbar.

Response

Define how the responses from the HTTP Datasource will be handled if the the connection is either successful or fails.

FieldDescription
Connected successfully
Record Export Time

Optionally, in the drop-down list, select an attribute from the input table.

When the exporter writes a record to the target HTTP location, the selected attribute in the input record is updated with the export time.



If a record in the input table is not exported, the selected attribute is left blank.

If a record is exported but the export is rolled back, the attribute will be updated by the export, then rolled back to a blank record.

If a record fails to export, the attribute is updated and remains updated even if the export transaction in the target HTTP datasource is rolled back.

Record Export Status

Optionally, in the drop-down list, select an attribute from the input table.

When the exporter writes a record to the target HTTP location, the selected attribute in the input record is updated with the value from the Status expression.

Record Response

Optionally, in the drop-down list, select an attribute from the input table.

When the exporter writes a record to the target HTTP location, the selected attribute in the input record is updated with any export messages from:

  • either Value to record on success 
  • or Value to record on failure
Status

Enter an expression to report a status. For example:

if(_success, _response, listToString($errors._MSGTEXT))

This value is used by Record Export Status to update an attribute in the input table.

Value to record on success

Enter an expression to report a response when the HTTP connection succeeds. For example:

countElements($errors = xmlToItems(_response,"//ERROR")) == 0

This value is used by Record Response to update an attribute in the input table.

Connection failed
Value to record on failure

Enter an expression to report a message when the HTTP connection fails. For example:

_error

This value is used by Record Response to update an attribute in the input table.

Inputs

This section has a list of the HTTP Headers defined for this exporter.

Multipliers

FieldDescription
Input Multiplier

Enter an expression that multiplies the data.  This works in the same way as the Input Multiplier Expressions on tables and File Exporters. A complete export is carried out for each value in the list of values returned by this expression. If the expression evaluates to an empty list, then no export will be carried out. If no expression is set, a single export will be carried out.

See Expressions and PhixScripts.

Advanced


FieldDescription
DatasourceThe HTTP Datasource that this exporter will send data to.
Datasource Instance Expression

The target datasource for this exporter may list multiple HTTP Datasource instances.
Each datasource instance is identified by a unique string. This expression should evaluate to a string which allows the HTTP Exporter to determine the instance to use.
If no value is entered then the exporter 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.

Exporter 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 exporter is used.

An icon can be set by uploading an  Image or using an image already uploaded to the application. If this field is left blank, PhixFlow checks for an icon set on the associated HTTP Datasource and uses that icon, and if that too is empty, then the default icon is used.

Timeout (secs)

Tells the exporter to timeout each export operation after a number of seconds. If an export operation does time out, the operation will be abandoned and an error will be reported. Each record that is timed out is considered to be a single error when assessing whether the entire export should be stopped and/or rolled back - see Errors Before Rollback below.

If no value is specified, the duration of an export operation is unlimited.

Parallel Exporters

If required, you can specify that the exporter should use a number of parallel exporters. Each buffer of records read from the input pipe will be divided across the parallel exporters. The restriction applied to this is that if Group By fields are specified in the input Pipe to the exporter, all records with the same Group By key will be exported by the same exporter.

If no value is specified here then only a single exporter will be used.

Errors Before Rollback

If required, you can set the maximum number of errors found, while exporting across all exporters, before the exporter will rollback all uncommitted transactions from all exporters.
If no value is specified, the exporter will never rollback, no matter how many errors are found.
If 1 is specified, a single error will cause a rollback.

Up to this number of errors, any errors reported from the exporter will appear as warnings in the log entries. The export will not be considered failed unless the number of errors is above this threshold.

Errors Before StoppingIf required, you can set the maximum number of errors found, while exporting across all exporters, before the exporter will stop attempting to export records to the datasource.
This is useful where you have set Errors Before Rollback (also configured on this tab), but wish to continue to try to export records to get view of how successful the remaining export would have been. Any records that the exporter attempts to export after the Errors Before Rollback limit has been passed will always be rolled back, even if they are successful.
If no value is entered, the exporter will stop when the Errors Before Rollback limit is reached.
Log Traffic

When system logging → Log Database Exporter Statements is ticked, PhixFlow always logs details of connections made by database exporters, whatever is set here; see System Logging Configuration

To change this property, you must have the Modify System Logging Configuration privilege.

 Untick to prevent logging. Ticking this box has no effect when the system logging option is ticked.

 Tick to log details of communication. Ticking this box has no effect when the system configuration option Allow Logging is not ticked.

Commit SizeIf you set Response options, the HTTP exporter is writing data into a PhixFlow table. Specify the number of records in a batch that the HTTP exporter writes to the database before committing changes.

Analysis Models

If this item is used by an analysis model, its name is listed here. See the Common Properties page, Analysis Model section for more details.

Description

We recommend that you always enter a description to explain the purpose of this item.

 Audit Tab

Audit Summary

See the Common Properties page, Audit Summary section.

Sections on this page

Learn More

For links to all pages in this topic, see Analysis Models