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
surveyCodeis thecodeof a survey returned byGET /api/v2/users/surveys.- No application module is needed: the access is the one of the variables and carriers of the survey.
Response
weeksandweightsare always present, empty when the survey has none. The order is the one of the survey.- A week has its
id(YYYY/WW), itsyearandweekas numbers, and its first and last day instartDateandendDate, in UTC. - A weighting has its
id, itslabel, itsuniversewhen there is one, andisDefault. Thelabelof 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
TABULATIONorREACH_TABLE,weeksandweightof the table are checked against these lists: a value that is not in them returns400(AE_ERR_400). Without them, the first week of the survey and its default weighting, the one withisDefault, are used. - In a survey wave of a
TRENDorREACH_TREND, a value that is not in them discards the wave with theTR_ERR_107diagnostic. - In Reach tables, weeks and weightings are validated but do not change the Reach figures.
Errors
| Status | errorCode | When |
|---|---|---|
| 400 | TW_ERR_500 | The X-API-Key value does not identify a TOM user. |
| 401 | E401 | The X-API-Key header is missing or empty. |
| 403 | AE_ERR_415 | The survey is not available to the user, or it does not exist. |
| 500 | GEN_ERR_500 | Unexpected error. |
Request
Responses
- 200
- 400
- 401
- 403
- 500
Weeks and weightings of the survey.
The X-API-Key value does not identify a TOM user (TW_ERR_500).
The X-API-Key header is missing or empty.
The survey is not available to the user: not contracted, disabled, being loaded or non-existent. The answer is the same in every case (AE_ERR_415).
Unexpected error.