Skip to main content

Calculate a table as HTML

POST 

/api/v2/table/:surveyCode/html

Calculates a table from the same definition as the JSON table calculation and returns it rendered as HTML.

It works like POST /api/v2/table/{surveyCode}, but the response is HTML instead of JSON. Use it to show a table to people (a preview, an e-mail or an embedded report) without writing your own renderer. To process the figures, use the JSON operation.

Request​

The body follows the same model and rules as POST /api/v2/table/{surveyCode}, with these differences:

  • dataType, locale and decimals are ignored, and invalid values of these fields are not rejected.
  • The HTML renders one slice. When several items of a PLANES axis are selected, it shows only the first selected item and leaves out the others: to render several slices, call this operation once per slice.
  • No diagnostics are returned.
  • weeks, weight, the survey waves of a SOURCES axis, targetMedia, diaryFilters and REACH_TREND follow the same rules as in the JSON operation, with the same errors: AE_ERR_400, AE_ERR_402, AE_ERR_404, AE_ERR_411 and AE_ERR_412, RC_ERR_100 for a REACH_TREND on a survey without Reach, and 403 (AE_ERR_408) for a REACH_TREND without the Reach module. A REACH_TREND is rendered like any other table.

Response​

200 returns text/html with the markup of the calculated table. The markup is meant for display only, and its structure is not a stable contract: do not parse it.

Errors are returned as application/problem+json, not as HTML, with the same codes as the JSON operation except the ones for dataType and decimals; the AE_ERR_400 for an extraParams switch with an invalid value still applies. Clients must accept both text/html and application/problem+json: a request whose Accept header does not include text/html is answered with 406 (E406).

Request​

Responses​

The calculated table rendered as HTML (text/html).