Skip to content

Get a question

client.Questions.Get(ctx, questionID) (*QuestionUnion, error)
GET/v5/questions/{question_id}

Retrieve a single question in the caller’s account by its ID.

Both active and archived questions are returned; the archived state is conveyed by the archived_at field on the response. The lookup is scoped to the caller’s account, and a question that does not exist within that account results in a not-found error.

ParametersExpand Collapse
questionID string
ReturnsExpand Collapse
type QuestionUnion interface{…}
One of the following:
type CategoricalQuestion struct{…}
ID string

Unique identifier of the entity

Choices []string

Categorical answer choices (must contain at least one entry)

Multi boolOptional

Whether the question allows multiple answers.

CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Object CategoricalQuestionObjectOptional
QuestionType CategoricalQuestionQuestionTypeOptional
type RatingQuestion struct{…}
ID string

Unique identifier of the entity

MaxLabel string

Label shown for the maximum rating

MinLabel string

Label shown for the minimum rating

Steps int64

Number of discrete points on the scale (e.g., 5 for a 1–5 scale)

minimum1
CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Object RatingQuestionObjectOptional
QuestionType RatingQuestionQuestionTypeOptional
type NumberQuestion struct{…}
ID string

Unique identifier of the entity

CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Configuration NumberQuestionConfigurationOptional
Max float64Optional

Maximum value for the number

Min float64Optional

Minimum value for the number

Object NumberQuestionObjectOptional
QuestionType NumberQuestionQuestionTypeOptional
type FreeTextQuestion struct{…}
ID string

Unique identifier of the entity

CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Configuration FreeTextQuestionConfigurationOptional
MaxLength int64Optional

Maximum characters allowed

minimum1
MinLength int64Optional

Minimum characters required

minimum0
Object FreeTextQuestionObjectOptional
QuestionType FreeTextQuestionQuestionTypeOptional
type FormQuestion struct{…}
ID string

Unique identifier of the entity

FormSchema map[string, any]

The JSON schema of the desired form object

CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Object FormQuestionObjectOptional
QuestionType FormQuestionQuestionTypeOptional
type TimestampQuestion struct{…}
ID string

Unique identifier of the entity

CreatedAt Time

ISO-timestamp when the entity was created

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
Name string
Prompt string

user-facing question prompt

ArchivedAt TimeOptional

ISO-timestamp when the entity was archived

formatdate-time
Conditions []map[string, any]Optional

Conditions for the question to be shown

Configuration TimestampQuestionConfigurationOptional
Multi boolOptional

Whether to allow multiple timestamps

Object TimestampQuestionObjectOptional
QuestionType TimestampQuestionQuestionTypeOptional

Get a question

package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  question, err := client.Questions.Get(context.TODO(), "question_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", question)
}
{
  "id": "id",
  "configuration": {
    "choices": [
      "string"
    ],
    "dropdown": true,
    "multi": true
  },
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": {
    "id": "id",
    "type": "user",
    "object": "identity"
  },
  "name": "name",
  "prompt": "prompt",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "conditions": [
    {
      "foo": "bar"
    }
  ],
  "object": "question",
  "question_type": "categorical"
}
Returns Examples
{
  "id": "id",
  "configuration": {
    "choices": [
      "string"
    ],
    "dropdown": true,
    "multi": true
  },
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": {
    "id": "id",
    "type": "user",
    "object": "identity"
  },
  "name": "name",
  "prompt": "prompt",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "conditions": [
    {
      "foo": "bar"
    }
  ],
  "object": "question",
  "question_type": "categorical"
}