Getting the Datapaths of a Report Element

Usage

Gets the datapaths available for a report element.

A datapath allows you to find a specific instance of a report element that can be used for example in several sections, or to find a specific report element of type cell in a table. The datapath may also be used to export a report element or to get its associated data.

Request

GET /documents/<documentID>/reports/<reportID>/elements/<elementID>/datapaths?<optional_parameters>

Table 1: Optional Parameters
Parameter Description
datapath A string that specifies an initial datapath needed to get to the next level, for example datapaths?datapath=DP0.DO18:"FY93".
reference A string that specifies a reference, for example datapaths?reference=1.D.7.
Caution You cannot use datapath and reference parameters in the same URL. This generates a 400 HTTP error.
Response

Response type: application/xml or application/json

Example

No Datapath

GET /documents/8413/reports/1/elements/20/datapaths

Response:

<datapaths elementId="17">
    <datapath>DP0.DObc:"2004"</datapath>
    <datapath>DP0.DObc:"2005"</datapath>
    <datapath>DP0.DObc:"2006"</datapath>
</datapaths>
Note The returned elementId attribute specifies the report element identifier on which to go on iterating.

Example

With a Datapath

GET /documents/8413/reports/1/elements/17/datapaths?datapath=DP0.DObc:"2006"

Response:

<datapaths elementId="10">
    <datapath>DP0.DObc:"2006",DP0.DOda:"California"</datapath>
    <datapath>DP0.DObc:"2006",DP0.DOda:"Colorado"</datapath>
    <datapath>DP0.DObc:"2006",DP0.DOda:"DC"</datapath>
    <datapath>DP0.DObc:"2006",DP0.DOda:"Florida"</datapath>
    <datapath>DP0.DObc:"2006",DP0.DOda:"Illinois"</datapath>
    <datapath>DP0.DObc:"2006",DP0.DOda:"Massachusetts"</datapath>
    <datapath>DP0.DObc:"2006",DP0.DOda:"New York"</datapath>
    <datapath>DP0.DObc:"2006",DP0.DOda:"Texas"</datapath>
 </datapaths> 

Example

With a Reference

GET /documents/8413/reports/1/elements/10/datapaths?reference=1.5.2.7

Response:

<datapaths elementId="11">
    <datapath>DP0.DOa5:"Accessories"</datapath>
    <datapath>DP0.DOa5:"City Skirts"</datapath>
    <datapath>DP0.DOa5:"City Trousers"</datapath>
    <datapath>DP0.DOa5:"Dresses"</datapath>
    <datapath>DP0.DOa5:"Jackets"</datapath>
    <datapath>DP0.DOa5:"Leather"</datapath>
    <datapath>DP0.DOa5:"Outerwear"</datapath>
    <datapath>DP0.DOa5:"Overcoats"</datapath>
    <datapath>DP0.DOa5:"Shirt Waist"</datapath>
    <datapath>DP0.DOa5:"Sweaters"</datapath>
    <datapath>DP0.DOa5:"Sweat-T-Shirts"</datapath>
    <datapath>DP0.DOa5:"Trousers"</datapath>
 </datapaths>

Example

Workflow
  1. GET /documents/8275/reports/1/elements/16/dataset to get chart data (ID=16).

    This returns an error:

    <error>
        <error_code>101</error_code>
        <message>The resource of type "Report element" with identifier "16" contains datapaths: one must be 
            specified.</message>
    </error>
  2. GET /documents/8275/reports/1/elements/16/datapaths to get a datapath to access values.

    This returns:

    <datapaths elementId="5">
        <datapath>DP0.DO18:"FY92"</datapath>
        <datapath>DP0.DO18:"FY93"</datapath>
        <datapath>DP0.DO18:"FY94"</datapath>
        <datapath>DP0.DO18:"FY95"</datapath>
    </datapaths>
  3. GET /documents/8275/reports/1/elements/5/datapaths?datapath=DP0.DO18:"FY92" to get the needed datapath, given the elementId and the chosen datapath:
    <datapaths elementId="8">
        <datapath>DP0.DO18:"FY92",DP0.DO1a:"Q1"</datapath>
        <datapath>DP0.DO18:"FY92",DP0.DO1a:"Q2"</datapath>
        <datapath>DP0.DO18:"FY92",DP0.DO1a:"Q3"</datapath>
        <datapath>DP0.DO18:"FY92",DP0.DO1a:"Q4"</datapath>
    </datapaths>
  4. GET /documents/8275/reports/1/elements/8/datapaths?datapath=DP0.DO18:"FY92",DP0.DO1a:"Q1" to iterate until the datapath list is empty:
    <datapaths/>
  5. GET /documents/8275/reports/1/elements/16/dataset?datapath=DP0.DO18:"FY92",DP0.DO1a:"Q1" to get the chart data using the chosen datapath:
    <dataset>
        <data id="Category" type="String">
            <label>Month</label>
            <value>Feb</value>
        </data>
        <data id="Value" type="Numeric">
            <label>Revenue</label>
            <value>291190</value>
        </data>
    </dataset>