DTN ProphetX® Web Services

The Format Parameter

Most requests to PXWeb support a common parameter named Format, which instructs PXWeb to perform a transformation on the XML result before being delivered to the client program.

The actual value of this parameter is prefixed by a three letter code that indicates the final format of the result according to the following table:

PrefixDescription
XML This is the default value and returns an XML result without any transformation.
HTM An HTML code fragment that can be embedded directly into a web page.
CSV A series of rows with comma separated fields.
JSN A JSON representation of contents of the result.
HTMLPAGE A full HTML web page. Only available on the GetNewsStory request.
HTMLDIV An HTML code fragment inside <div> tags. Only available on the GetNewsStory request.

The base formats are identified by the three letter codes from the above table; however, as more formats are added they will be identified by the three letter code used as a preffix and followed by a code to make them unique like, for example, HTM1 or CSV1.

The specific list of Format codes supported for each report is included at the end of each documentation page.

An XML result is returned in the case of an exception and the client program must verify for this condition before taking any further action with the result.

The Format parameter is supported only when accessing PXWeb via the following URLs:

The HTM option

The purpose of the HTM option is to return HTML code that can be embedded in a web page and presented using the styling characteristics of the host site without any direct manipulation on the result.  The HTML fragment consists of a series of HTML table rows, which can be wrapped inside an HTML table.

For an example, assume the following request via PXServiceWeb:

     GetQuoteSnap?UserID=user&Password=pswd&Type=Last,Change,Previous&Symbol=NG@1&Format=HTM
	

PXWeb would return an HTML fragment similar to the following:

    <tr>
        <th>TickerSymbol</th>
        <th>Last</th>
        <th>Change</th>
        <th>Previous</th>
    </tr>
    <tr>
        <td>NGV12</td>
        <td>2.773</td>
        <td>-0.092</td>
        <td>2.865</td>
    </tr>
	

Assuming that the above HTML fragment was received in a variable named PXWebResponse using ASP or JSP, the client program could just wrap the HTML fragment inside a table as follows:

    <html>
        <head>
            <link href='Style.css' rel='stylesheet' type='text/css'/>
        </head>
        <table class='pxtable'>
            <%= PXWebResponse %>
        </table>
    </html>
	

Although all the styling could be contained in the web page itself, it is more common to have a separate CSS file containing styling definitions for the web site.  In the above example, a reference to an external CSS file is included for styling.

The following is an example of what could be the contents of the external CSS file:

    body
    {
        background: white;
        font-size: .83em;
        font-family: "Helvetica Neue", "Lucida Grande", "Segoe UI", Arial, Helvetica, Verdana, sans-serif;
        margin: 0px;
        padding: 0px;
        color: #494949;
    }
    table.pxtable
    {
        border-collapse: collapse;
        margin: 4px 12px;
    }
    table.pxtable td
    {
        border-width: 1px;
        border-color: gray;
        border-style: dotted;
        padding: 2px 6px;
    }
	

The HTMLPAGE and HTMLDIV options

The GetNewsStory request supports two extra format methods: HTMLPAGE and HTMLDIV. These formats are for requesting rich text news stories in HTML, and they use header tags, paragraph tags, embedded links, pre tags, and others to add formatting to the stories.

The HTMLPAGE format will return a full HTML page including a basic style sheet. The HTMLPAGE format can be used as a complete stand-alone web page, or it can be embedded into an iframe.

HTMLDIV will return an HTML fragment containing the headers and text of a news story wrapped in an HTML <div> tag. The HTML fragment returned by HTMLDIV can be embedded into another web page that is being assembled for the end user. The <div> tag that wraps the fragment will contain an id attribute of "dtn_news". (i.e. <div id="dtn_news">) The HTML fragment contains no style information and will inherit the style of the page it is embedded in.