Get survey results using the Poll API.

Introduction

Surveys allow you to collect data about your organization's enterprise architecture landscape from various stakeholders. Learn more about surveys in our user documentation.

As an administrator, you can manage surveys programmatically using the Poll REST API. In this guide, you will learn how to retrieve survey results through the Poll API.

📘

In the API reference and this guide, surveys are referred to as polls.

The Poll API allows you to manage the following data:

  • Polls: A poll is a template of a survey form that a survey creator sends out to recipients to collect the desired information for specific Fact Sheets. Each poll has a unique ID.
  • Poll runs: A poll run is an operation of sending a specific version of a poll to recipients. Each poll run has a unique ID.
  • Poll results: A poll result stores the answers of survey recipients for a specific Fact Sheet. Each Fact Sheet included in a poll run generates a poll result with a unique ID.
See how polls appear in the UI.

To navigate to polls in LeanIX EAM, in the Administration section, select Surveys under Advanced Settings. You see a list of polls for your Workspace. Each poll has a unique ID.

A list of polls in the Surveys section in the LeanIX EAM Administration

A list of polls in the Surveys section in the LeanIX EAM Administration

To navigate to poll runs, select a poll in the Surveys list, and then go to Status & results. Each poll run that appears in the list has a unique ID.

A list of poll runs for an example poll in the Surveys section

A list of poll runs for an example poll

To navigate to poll run details, on the Status & results tab, select a poll run. Each Fact Sheet in the poll run that appears on the Fact Sheets tab of the overlay generates a unique poll result ID.

A list of Fact Sheets included in a poll run

A list of Fact Sheets included in a poll run

Authentication

To learn how to authenticate to our APIs, see Authentication to LeanIX APIs.

In all API requests listed on this page, replace {ACCESS_TOKEN} with your access token.

API Reference

You can view the reference documentation for the Poll API in the OpenAPI Explorer. The base URL differs for different customers, so make sure to use the right link.

To navigate to the OpenAPI Explorer from your Workspace, on the user menu, select About LeanIX, and then select Browse API. In the OpenAPI Explorer, select Poll in the upper-right corner.

Step 1. Get the Poll ID

First, let's get the identifier of the poll for which you want to retrieve results. Call the following endpoint:

GET https://{SUBDOMAIN}.leanix.net/services/poll/v2/polls

👍

How do I get my {SUBDOMAIN} value?

Copy the subdomain value from your Workspace URL. Learn more about the base URL.

Example subdomain in a Workspace URL

Example subdomain in a Workspace URL

Example Request

Let's retrieve a poll by its title using the q query parameter (Location in the example).

The values for page, size, and sort are default in the example request.

curl -X GET 
--header 'Accept: application/json' 
--header 'Authorization: Bearer {ACCESS_TOKEN}'
'https://{SUBDOMAIN}.leanix.net/services/poll/v2/polls?page=1&size=30&sort=creationDate-desc&q=Location'

Example Response

From the response, save the id of the desired poll.

{
  "status": "OK",
  "type": "Poll",
  "errors": [],
  "total": 1,
  "data": [
    {
      "id": "0b62781b-4266-4020-{...}-4cacb7947ba8",
      "legacyId": null,
      "questionnaire": {...},
      "title": "Location",
      "language": "en",
      ...
    }
  ]
}

Step 2. Get the Poll Run ID

Now that you have the id of the poll, send a request to retrieve all runs for this poll. Use the following endpoint:

GET https://{SUBDOMAIN}.leanix.net/services/poll/v2/polls/{id}/pollRuns

Example Request

Let's retrieve all runs for the example poll using the poll id.

The values for page, size, and sort are default in the example request.

curl -X GET 
--header 'Accept: application/json' 
--header 'Authorization: Bearer {ACCESS_TOKEN}'
'https://{SUBDOMAIN}.leanix.net/services/poll/v2/polls/0b62781b-4266-4020-{...}-4cacb7947ba8/pollRuns?page=1&size=500&sort=startTime-desc'

Example Response

From the response, save the id of the desired poll run.

{
  "status": "OK",
  "type": "PollRun",
  "errors": [],
  "total": 2,
  "data": [
    {
      "id": "ce6a4af8-7060-4adc-{...}-2daa85efe616",
      "legacyId": null,
      "poll": {...},
      "status": "STARTED",
      "progress": null,
      "startTime": "2023-08-24T10:55:54.693671Z",
      ...
    },
    {
      "id": "c0735b3b-b032-4b0d-{...}-77f5e68b5210",
      "legacyId": null,
      "poll": {...},
      "status": "STARTED",
      "progress": null,
      "startTime": "2023-08-22T06:40:08.927306Z",
      ...
    }
  ]
}

Step 3. Get Poll Results

You can get poll results:

Get Results for All Fact Sheets in a Poll Run

With the poll run ID, you can retrieve results for all Fact Sheets included in the poll run. Call the following endpoint:

GET https://{SUBDOMAIN}.leanix.net/services/poll/v2/pollRuns/{pollRunID}/pollResults

Example Request

curl -X GET 
--header 'Accept: application/json' 
--header 'Authorization: Bearer {ACCESS_TOKEN}'
'https://{SUBDOMAIN}.leanix.net/services/poll/v2/pollRuns/ce6a4af8-7060-4adc-{...}-2daa85efe616/pollResults'

Example Response

The response contains poll results for all Fact Sheets included in the poll run. Each result is associated with a specific Fact Sheet and has a unique ID.

{
  "status": "OK",
  "type": "PollResultDTO",
  "errors": [],
  "total": 2,
  "data": [
    {
      "id": "10fd7951-1e44-4643-{...}-ed5db8c44e29",
      "pollRunId": "ce6a4af8-7060-4adc-{...}-2daa85efe616",
      "status": "DONE",
      "answers": [
        {
          "questionId": "cc2a3670-9d9d-5e41-{...}-c579cdd89b1c",
          "answer": [
            "Users are based in Australia."
          ],
          ...
    {
      "id": "2dff1a8b-33b6-494c-b855-c8604045e333",
      "pollRunId": "ce6a4af8-7060-4adc-{...}-2daa85efe616",
      "status": "DONE",
      "answers": [
        {
          "questionId": "cc2a3670-9d9d-5e41-{...}-c579cdd89b1c",
          "answer": [
            "Users are based in Brazil."
          ],
          ...
    }

Get a Result for a Specific Fact Sheet in a Poll Run

You can get a result for a specific Fact Sheet included in a poll run by the result ID. First, retrieve all results, and then save the id of the desired result from the response.

To retrieve a specific poll result, call the following endpoint:

GET https://{SUBDOMAIN}.leanix.net/services/poll/v2/pollResults/{pollResultID}

Example Request

curl -X GET 
--header 'Accept: application/json' 
--header 'Authorization: Bearer {ACCESS_TOKEN}'
'https://{SUBDOMAIN}.leanix.net/services/poll/v2/pollResults/10fd7951-1e44-{...}-ae7c-ed5db8c44e29'

Example Response

In the response, you get the requested poll result for a specific Fact Sheet.

{
  "status": "OK",
  "type": "PollResultDTO",
  "errors": [],
  "total": 0,
  "data": {
    "id": "10fd7951-1e44-4643-{...}-ed5db8c44e29",
    "pollRunId": "ce6a4af8-7060-4adc-{...}-2daa85efe616",
    "status": "DONE",
    "answers": [
      {
        "questionId": "cc2a3670-9d9d-5e41-{...}-c579cdd89b1c",
        "answer": [
          "Users are based in Australia."
        ],
        "comments": null,
        "lastModified": "2023-08-25T06:50:28.288193Z",
        "lastModifiedBy": "1cec1b72-d073-4bf1-{...}-c80ba68e095b",
        "substitute": null,
        "jsonAnswer": null
      }
    ],
    "users": [...],
    "requestingUser": null,
    "sender": {...},
    "factSheet": {...}
  }
}