Skip to main content

List the weeks and weightings of a survey

GET 

/api/v2/survey/:surveyCode/weeks-and-weights

Returns the weeks and the weightings a survey accepts in a calculation, in the order of the survey.

Send the id of a week in weeks, and an item of weights as weight, of a table or of a survey wave of a SOURCES axis. An item of weights can be sent as it is returned: only its id is read.

Before you call it​

  • surveyCode is the code of a survey returned by GET /api/v2/users/surveys.
  • No application module is needed: the access is the one of the variables and carriers of the survey.

Response​

  • weeks and weights are always present, empty when the survey has none. The order is the one of the survey.
  • A week has its id (YYYY/WW), its year and week as numbers, and its first and last day in startDate and endDate, in UTC.
  • A weighting has its id, its label, its universe when there is one, and isDefault. The label of a weighting is the one the survey defines; it is not translated.
  • The lists are read each time: a survey gains weeks when new data is loaded, so do not keep them for long.

How the values are used​

  • In a TABULATION or REACH_TABLE, weeks and weight of the table are checked against these lists: a value that is not in them returns 400 (AE_ERR_400). Without them, the first week of the survey and its default weighting, the one with isDefault, are used.
  • In a survey wave of a TREND or REACH_TREND, a value that is not in them discards the wave with the TR_ERR_107 diagnostic.
  • In Reach tables, weeks and weightings are validated but do not change the Reach figures.

Errors​

StatuserrorCodeWhen
400TW_ERR_500The X-API-Key value does not identify a TOM user.
401E401The X-API-Key header is missing or empty.
403AE_ERR_415The survey is not available to the user, or it does not exist.
500GEN_ERR_500Unexpected error.

Request​

Responses​

Weeks and weightings of the survey.