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,localeanddecimalsare ignored, and invalid values of these fields are not rejected.- The HTML renders one slice. When several items of a
PLANESaxis 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
diagnosticsare returned. weeks,weight, the survey waves of aSOURCESaxis,targetMedia,diaryFiltersandREACH_TRENDfollow the same rules as in the JSON operation, with the same errors:AE_ERR_400,AE_ERR_402,AE_ERR_404,AE_ERR_411andAE_ERR_412,RC_ERR_100for aREACH_TRENDon a survey without Reach, and403(AE_ERR_408) for aREACH_TRENDwithout the Reach module. AREACH_TRENDis 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
- 200
- 400
- 401
- 403
- 406
- 500
The calculated table rendered as HTML (text/html).
The body cannot be turned into a table or the table cannot be calculated, with the same codes as POST /api/v2/table/{surveyCode} except the ones for dataType and decimals. AE_ERR_401: invalid value of an enumerated field. AE_ERR_405: target or targetBase has neither id nor filterTgl. AE_ERR_409 and AE_ERR_410: axisType is missing, unknown or valid only in responses, or the CARRIERS axis of a REACH_TREND is in PLANES, or a SOURCES or DIFFERENCES axis comes in a table that is not a TREND or a REACH_TREND. AE_ERR_411: a field that the object does not accept. AE_ERR_413: no axes, or no body. A variable of a VARIABLES axis that cannot be converted returns AE_ERR_412 (missing subtype, id or filterTgl) or AE_ERR_416 (unsupported combination); both locate the axis, dimension, variable, field and offending value (if any). AE_ERR_400: an extraParams switch has an invalid value. AE_ERR_400 also covers weeks or weight sent with a table type that does not take them, a week or a weighting the survey does not have, and targetMedia or diaryFilters with a table type that is not Reach. AE_ERR_411 covers an unknown field in a survey wave of a SOURCES axis or in its weight, and AE_ERR_412 a weight without id. AE_ERR_404 covers more than one selected survey wave in a SOURCES axis in PLANES. A REACH_TREND without its SOURCES, DIFFERENCES or CARRIERS axis returns AE_ERR_412, a statistic outside the catalog of its axis returns AE_ERR_402, and a survey of the path without Reach returns RC_ERR_100, all before calculating. T_ERR_104 (no statistics), T_ERR_106, VA_ERR_101 and RC_ERR_100 are raised by the calculation engine. A TREND without its SOURCES or DIFFERENCES axis returns the code of the calculation engine, TR_ERR_101 or TR_ERR_103; a REACH_TREND gets AE_ERR_412 instead. A TREND or REACH_TREND also returns the codes of the calculation engine unchanged: TR_ERR_105 (no valid survey wave), TR_ERR_106 (invalid trendCategoriesMode) and TR_ERR_109 (no survey wave left after checking the variables of the table). A discarded survey wave is not an error: it is a TR_ERR_107 diagnostic of a 200 response. SO_ERR_201: the survey is disabled or being loaded. E400: the body is not valid JSON.
The X-API-Key header is missing or empty (E401), or the survey is not in the user's profile or does not exist (SO_ERR_203).
The user's profile does not include the module the table type needs (AE_ERR_408): Tabulation for TABULATION, Study for TREND, BREAKDOWN_CARRIERS and DUPLICATIONS, and Reach for REACH_TABLE, REACH_DUPLICATION and REACH_TREND.
The Accept header of the request does not include text/html (E406).
Unexpected error.