POST <webiURL>/documents/{documentId}/reports/{reportId}/elements?unit={unit}
Request type: application/xml or application/json
Request body: the valid definition of an element. See the Chart XML Grammar in case of a chart.
Elements are structured as a tree. There is a relationship of parent element and children. For instance, when you put a cell (ID = 5) into the body page zone (ID = 1), the parent ID of the cell is 1. This mechanism allows to add an element in the report structure with accuracy.
Some settings are common to all types of report elements, while some are only specific. These specific settings are located into content tags. The element is added and an ID attributed to the element.
Response type: application/xml or application/json
The response is a message stating the success or failure of the request.
POST <webiURL>/documents/127/reports/1/elements?unit=inch
In the request body, you define the cell dimensions, padding and contents.
<element type="Cell"> <parentId>2</parentId> <size minimalWidth="2.23" minimalHeight="3.56" autofitWidth="false" autofitHeight="true"/> <padding left="0.069" right="0.069" top="0.069" bottom="0.069"/> <content> <expression> <formula type="Text" dataType="Numeric">=Sum([Sales revenue])</formula> </expression> </content> </element>
POST <webiURL>/documents/127/reports/1/elements
In the request body, you define how duplicate row aggregation is managed and a formula.
<element type="Section"> <parentId>2</parentId> <size minimalHeight="1000"/> <padding bottom="1000"/> <position repeatOnEveryVerticalPage="true"/> <style> <background> <color rgb="#0000ff"/> </background> </style> <content> <axes duplicateRowAggregation="true"> <axis role="Row"> <expressions> <formula dataType="String">=[Year]</formula> </expressions> </axis> </axes> </content> </element>
POST <webiURL>/documents/14695/reports/1/elements
Request body:
<element type="XTable"> <parentId>2</parentId> <content> <axes> <axis role="Row"> <expressions> <formula dataType="String">=[Country]</formula> <formula dataType="String">=[Year]</formula> </expressions> </axis> <axis role="Column"> <expressions> <formula dataType="String">=[Resort]</formula> <formula dataType="String">=[Service]</formula> </expressions> </axis> <axis role="Body"> <expressions> <formula dataType="Numeric">=[Number of guests]</formula> <formula dataType="Numeric">=[Revenue]</formula> </expressions> </axis> </axes> </content> </element>
POST <webiURL>/documents/13069/reports/6/elements?unit=centimeter
Request body:
<element type="Visualization"> <parentId>2</parentId> <content> <chart type="HorizontalBar"> <axes> <axis role="Color"> <expressions> <formula dataType="String">=[Resort]</formula> <formula dataType="String">=[Country]</formula> </expressions> </axis> <axis role="Category"> <expressions> <formula dataType="String">=[Year]</formula> </expressions> </axis> <axis role="Value"> <expressions> <formula dataType="Numeric">=[Revenue]</formula> </expressions> </axis> </axes> </chart> </content> </element>