GET

/Surveys

Returns a list of all surveys available to the caller within the API system.

Overview

This method returns a list of “SurveyDetail” objects. The surveys available to the caller will be defined by the internal details (e.g., authentication, permissions) of the survey system.

The method returns a full list of all surveys available with no filtering or paging options. This endpoint is typically used to retrieve a list of surveys to display in a user interface for user selection.

Request

GET /Surveys

Example Request URL

https://tsapi-demo.azurewebsites.net/Surveys

Response

Returns an array of SurveyDetail objects:

[
  {
    "id": "1e6cb0a1-2289-4650-9148-9fc3e6e129b2",
    "name": "TS-001",
    "title": "Customer Experience Survey"
  },
  {
    "id": "a4bd7eed-88df-4a57-86d6-396e3698022e",
    "name": "TS-002",
    "title": "Cereal Awareness Survey"
  }
]

SurveyDetail Object

The SurveyDetail object contains a minimal set of information to identify a survey within the API system.

FieldTypeDescription
idstringUnique identifier (GUID) for the survey
namestringShort name/code for the survey
titlestringHuman-readable title of the survey

Response Schema

[
  {
    "id": "string",
    "name": "string",
    "title": "string"
  }
]

Usage

Once a survey selection has been made (typically by the user in your interface), you can use the survey id to make further API calls:

Example Usage

JavaScript (fetch)

const response = await fetch('https://tsapi-demo.azurewebsites.net/Surveys');
const surveys = await response.json();

// Display surveys to user
surveys.forEach(survey => {
  console.log(`${survey.name}: ${survey.title}`);
});

Python (requests)

import requests

response = requests.get('https://tsapi-demo.azurewebsites.net/Surveys')
surveys = response.json()

for survey in surveys:
    print(f"{survey['name']}: {survey['title']}")

cURL

curl https://tsapi-demo.azurewebsites.net/Surveys