GET

/Surveys/{id}/Metadata

Returns the complete metadata for a specific survey, including all variable definitions, sections, and value options.

Overview

The metadata endpoint provides the full structure of a survey. This includes information about all questions (variables), their types, labels, and possible answer values. Understanding the metadata is essential for interpreting the interview data.

Request

GET /Surveys/{id}/Metadata

Path Parameters

ParameterTypeDescription
idstring (GUID)The unique identifier of the survey (from GET /Surveys)

Example Request URL

https://tsapi-demo.azurewebsites.net/Surveys/1e6cb0a1-2289-4650-9148-9fc3e6e129b2/Metadata

Response Structure

The response contains the complete survey metadata:

{
  "hierarchies": [],
  "name": "TS-001",
  "title": "Customer Experience Survey",
  "interviewCount": 3000,
  "languages": [
    {
      "languageId": "EN",
      "name": "English"
    }
  ],
  "variables": [],
  "sections": [
    {
      "label": { "text": "System", "altLabels": [] },
      "variables": [...]
    },
    {
      "label": { "text": "Demographics", "altLabels": [] },
      "variables": [...]
    }
  ]
}

Response Fields

FieldTypeDescription
namestringSurvey short name/code
titlestringSurvey title
interviewCountintegerTotal number of interviews
languagesarrayAvailable languages for labels
variablesarrayRoot-level variables (if not using sections)
sectionsarrayGrouped sections containing variables
hierarchiesarrayOptional hierarchical structures

Variable Object

Each variable represents a question in the survey:

{
  "variableId": "4",
  "ordinal": 0,
  "type": "single",
  "name": "Q2",
  "label": {
    "text": "Frequency of visit",
    "altLabels": [
      {
        "mode": "interview",
        "text": "Have you visited here before?",
        "languageId": "EN"
      },
      {
        "mode": "analysis",
        "text": "Visited before",
        "languageId": "EN"
      }
    ]
  },
  "values": {
    "values": [
      {
        "valueId": "0",
        "code": "0",
        "label": { "text": "No, this is the first visit" }
      },
      {
        "valueId": "1",
        "code": "1",
        "label": { "text": "I visited before within the year" }
      }
    ]
  },
  "maxResponses": 0
}

Variable Fields

FieldTypeDescription
variableIdstringUnique identifier for the variable
typestringVariable type (single, multiple, quantity, etc.)
namestringShort name (e.g., Q1, Q2)
labelobjectMain label with optional alternative labels
valuesobjectPossible values (for categorical types)
maxResponsesintegerMaximum allowed responses
usestringOptional use type (e.g., "serial")

Variable Types

See Data Types for detailed information about each variable type:

  • single - Single response categorical
  • multiple - Multiple response categorical
  • quantity - Numeric values
  • character - Text/string values
  • date - Date values
  • time - Time values

Labels and Alternative Labels

Labels can have alternative versions for different contexts. The altLabels array contains labels for different “modes”:

  • interview - The question text shown to respondents
  • analysis - A shorter label for data analysis/reporting

Organizing Variables

Variables can be organized in two ways:

  1. Root level: Variables defined directly in the variables array
  2. Sections: Variables grouped into sections (e.g., “Demographics”, “Main Survey”)

Sections act like chapters in the survey, helping to organize related questions together.

Looped Variables

Some variables may contain loopedVariables - questions that are asked for each response to the parent variable. See the Data Types page for more details on nested structures.