Add a survey to a workspace
POST/api/v2/workspace/:workspaceId/source
Attaches a survey to a workspace so that it appears in the list of surveys of the workspace.
Get the workspace id from GET /api/v2/workspaces (or from POST /api/v2/workspace) and the survey code from GET /api/v2/users/surveys.
Behaviour
codemust be thecodeof a survey returned byGET /api/v2/users/surveys. The value is not checked against the survey catalog: an unknown code is accepted with200but never appears inGET /api/v2/workspace/{workspaceId}.- Adding a survey does not make it the workspace's active survey:
surveyCodeinGET /api/v2/workspacesdoes not change. - Do not add a code that is already attached to the workspace: the call is not idempotent and can fail. Check
surveysinGET /api/v2/workspace/{workspaceId}first. - In a workspace shared with you, the list of surveys is kept per user: the survey is added to your list only, and after the addition your list may no longer include the surveys the owner attached.
- The response echoes the accepted
codeanddescription; no identifier is created.descriptionisnullwhen it was not sent.
Errors
| Status | errorCode | When |
|---|---|---|
| 400 | VAL_ERR_001 | code is missing or empty, code is longer than 150 characters, or description is longer than 250. |
| 400 | E400 | The body is not valid JSON. |
| 400 | AE_ERR_400 | The body is a JSON array, or a value has the wrong JSON type, such as an array in code. The message names the field. |
| 400 | WS_ERR_101 | No workspace exists with this id. |
| 400 | WS_ERR_403 | The workspace is neither owned by nor shared with the caller. |
| 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. |
| 500 | GEN_ERR_500 | Unexpected error. Adding a survey that is already attached can end here. |
Request
Responses
- 200
- 400
- 401
- 500
The survey was attached. The body echoes the accepted values; description is null when it was not sent.
The request cannot be processed. VAL_ERR_001: code is missing or empty, or a field is longer than allowed. E400: the body is not valid JSON. AE_ERR_400: the body is a JSON array, or a value has the wrong JSON type. WS_ERR_101: no workspace exists with this id. WS_ERR_403: the workspace is neither owned by nor shared with the caller. TW_ERR_500: the X-API-Key value does not identify a TOM user.
The X-API-Key header is missing or empty.
Unexpected error. Adding a survey that is already attached can end here.