Skip to main content

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​

  • code must be the code of a survey returned by GET /api/v2/users/surveys. The value is not checked against the survey catalog: an unknown code is accepted with 200 but never appears in GET /api/v2/workspace/{workspaceId}.
  • Adding a survey does not make it the workspace's active survey: surveyCode in GET /api/v2/workspaces does not change.
  • Do not add a code that is already attached to the workspace: the call is not idempotent and can fail. Check surveys in GET /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 code and description; no identifier is created. description is null when it was not sent.

Errors​

StatuserrorCodeWhen
400VAL_ERR_001code is missing or empty, code is longer than 150 characters, or description is longer than 250.
400E400The body is not valid JSON.
400AE_ERR_400The body is a JSON array, or a value has the wrong JSON type, such as an array in code. The message names the field.
400WS_ERR_101No workspace exists with this id.
400WS_ERR_403The workspace is neither owned by nor shared with the caller.
400TW_ERR_500The X-API-Key value does not identify a TOM user.
401E401The X-API-Key header is missing or empty.
500GEN_ERR_500Unexpected error. Adding a survey that is already attached can end here.

Request​

Responses​

The survey was attached. The body echoes the accepted values; description is null when it was not sent.