GET Export Report HTMLTABLE Format

Abstract

Description of the HTMLTABLE export format of the GET Export Report API.


Table of Contents

The htmltable format writes HTML to the HTTP response body. The returned HTML is internally valid XML but not valid HTML since it is neither encapsulated with <html> nor <body> tags. This allows the returned HTML to be embedded within the DOM of an HTML Document.

Format Parameter:  htmltable

Response Content-Type:  text/html

OK Response

Status Code:  200

HTML Table responses without error have this DTD structure:

<!DOCTYPE table [
<!ELEMENT table (caption?,thead,tbody)>

<!ELEMENT caption (aside,h5,ul)>

<!-- aside: Contains the total row count -->
<!ELEMENT aside (#PCDATA)>

<!-- h5 and ul: optionally rendered if at least one filter or subquery with a description 
     is applied to the export results. In the case of filters, the h5 contains the 'Filters' 
     title, and the ul contains human readable filters (with table and column displayName 
     substituted for id's) in a bulleted list. In the case of subqueries with a description, 
     the h5 contains the 'Subqueries' title, and the ul contains the <subquery> description. -->
<!ELEMENT h5 (#PCDATA)>
<!ATTLIST h5 class CDATA>

<!ELEMENT ul (li)>

<!ELEMENT li (#PCDATA|em|samp)>
<!ELEMENT em (#PCDATA)>
<!ELEMENT samp (#PCDATA)>

<!ELEMENT thead (tr)>

<!ELEMENT tbody (tr)>

<!ELEMENT tr (th|td)>

<!-- th: Contains the <column> displayName -->
<!ELEMENT th (#PCDATA)>

<!-- th attributes: The 'tablePath' and 'columnId' value of each column is added as a data 
     attribute for every column header. This makes it possible to find the column associated
     with a given tablePath and columnId with a selector tool like JQuery. -->
<!ATTLIST th data-tablePath CDATA>
<!ATTLIST th data-columnId CDATA >

<!-- td: Contains the row value -->
<!ELEMENT td (#PCDATA|a)>

<!-- a: <column>'s with a <url_template> have their values surrounded with an HTML anchor
     tag (a) with the filled URL template as the value of the href attribute. -->
<!ELEMENT a (#PCDATA)>
<!ATTLIST a href CDATA>

]>
Example 1. Example HTML Table Output Format
<table>
    <caption>
        <aside>From 1 to 2 of 2</aside>
        <h5 class='filters-title'>Filters</h5>
        <ul>
            <li>Table: <em>Student</em>, Column: <em>First Name</em> <samp>like</samp> 'J%'</li>
            <li>Table: <em>Student</em>, Column: <em>Last Name</em> <samp>=</samp> 'Hernandez'</li>
        </ul>
        <h5 class='subqueries-title'>Subqueries</h5>
        <ul>
            <li>Table: <em>Student</em>: Rows are restricted to those students within your school.</li>
        </ul>
    </caption>
    <thead>
        <tr>
            <th data-tablepath="/student" colspan="3">Student</th>
        </tr>
        <tr>
            <th data-tablePath="/student" data-columnId="id">Student ID</th>
            <th data-tablePath="/student" data-columnId="fname">First Name</th>
            <th data-tablePath="/student" data-columnId="lname">Last Name</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>177</td>
            <td>Joe</td>
            <td><a href="/some/url/177">Hernadez</a></td>
        </tr>
        <tr>
            <td>213</td>
            <td>Julia</td>
            <td><a href="/some/url/213">Hernadez</a></td>
        </tr>
    </tbody>
</table>

Error Response

Status Code:  400 and 500

HTML Table responses with error have this structure:

<!DOCTYPE ul [
<!ELEMENT ul(li)>
<!ATTLIST ul class CDATA "error">

<!ELEMENT li(#PCDATA)>
]>
Example 2. Example HTML Table Error Output Format
<ul class="error">
    <li>The filter "/student@id &amp; 173" does not match filter grammar. The "Operator" definition is missing or unparseable.</li>
</ul>