Olery Developer Portal logo Olery Developer Portal

Method Path
PUT https://agora.olery.com/v3/feedback/questions

This endpoint is used to create a question.

Input Format

The request’s body can have the following fields:

Field Data Types Description
question String Question itself, in the default language (required)
type String Question’s type (required)
subscription_id Integer Subscription ID (required)
descriptions Array Array of hashes with translation for the question’s description field. See Descriptions Fields
translations Array Used to store question’s translations. See Translations Fields
max Integer Denotes the maximum characters allowed for an answer. Used when the question type is an open answer (normal or long)
min Integer Denotes the minimum characters allowed for an answer. Used when the question type is an open answer (normal or long)
max_value Integer Denotes the maximum rating. Used when the question type is a rating
required Boolean Indicates if the question is required
enabled_followup Boolean Indicates if the question has a follow up. Only for rating questions
links Array See Links Fields section
options Array See Options Fields section
config Hash See Config Fields section
topics Array Array of strings where each string represents a rating for the question

Each question can be one of the following types: date, drop_down, enum, multiple_select, open_answer, open_answer_long, past_date, rating or yes_no.

Descriptions Fields

The descriptions field is a hash where each key is a languages code. Each key has a hash with the following fields:

Field Data Types Description
_id String Language code
locale String Language code
description String Description in that language

The links field is and array of hashes. Every hash has a language code key and it value is another hash with the following fields:

Field Data Types Description
title String The link’s text to be displayed
url String The link itself

Translation Fields

The translation field is a hash where each key is a languages code. Each key has a hash with the following fields:

Field Data Types Description
_id String Language code
locale String Language code
translation String Question in that language

Options Fields

The option field inside the question is an array of hashes used to store the option ID and its translations. This field is used when the question has one of the following types: multiple_select, enum or drop_down. Each hash in the array has the following fields:

Field Data Types Description
id String Option’s ID.
default String Option in the default language
language code String Option in a specific language. There can be multiple fields like this, usually for all the survey’s available languages

Config Fields

This field is used to configure rating labels for questions of the the rating. It is a hash with another hash inside with a key named edge_labels with the following fields:

Field Data Types Description
best Hash It contains bey-value pairs, where the key is a language code and the value is the label in that language
worst Hash It contains bey-value pairs, where the key is a language code and the value is the label in that language

Each of this fields has also a default key-value pair, which represents the label in the default language. It follows an example for the config field:

"config": {
  "edge_labels": {
      "best": {
          "en": "Best",
          "es": "Mejor",
          "default": "Best"
      },
      "worst": {
          "en": "Worst",
          "es": "Peor",
          "default": "Worst"
      }
  }
}

Example Input

{
  "question": "Example question 1",
  "subscription_id": 1234,
  "type": "multiple_select",
  "descriptions": [
    {
      "_id": "en",
      "locale": "en",
      "translation": "Example description 1"
    },
    {
      "_id": "es",
      "locale": "es",
      "translation": "Ejemplo de descripción 1"
    }
  ],
  "translations": [
    {
      "_id": "en",
      "locale": "en",
      "translation": "Example question 1"
    },
    {
      "_id": "es",
      "locale": "es",
      "translation": "Ejemplo de pregunta 1"
    }
  ],
  "max": null,
  "min": null,
  "max_value": null,
  "required": true,
  "enabled_followup": false,
  "links": [],
  "options": [
    {
      "en": "English option 1",
      "es": "Opción española 1",
      "id": "english option 1",
      "default": "English option 1"
    },
    {
      "en": "English option 2",
      "es": "Opción española 2",
      "id": "english option 2",
      "default": "English option 2"
    }
  ],
  "config": {},
  "topics": ["bar", "sanitary_safety"]
}

Example Output

{
  "data": {
    "id": "dac0c43a456b568fd65fd4150",
    "question": "Example question 1",
    "type": "multiple_select",
    "descriptions": [
      {
        "_id": "en",
        "locale": "en",
        "translation": "Example description 1"
      },
      {
        "_id": "es",
        "locale": "es",
        "translation": "Ejemplo de descripción 1"
      }
    ],
    "translations": [
      {
        "_id": "en",
        "locale": "en",
        "translation": "Example question 1"
      },
      {
        "_id": "es",
        "locale": "es",
        "translation": "Ejemplo de pregunta 1"
      }
    ],
    "max": null,
    "min": null,
    "max_value": 5,
    "required": true,
    "enabled_followup": false,
    "links": [],
    "options": [
      {
        "en": "English option 1",
        "es": "Opción española 1",
        "id": "english option 1",
        "default": "English option 1"
      },
      {
        "en": "English option 2",
        "es": "Opción española 2",
        "id": "english option 2",
        "default": "English option 2"
      }
    ],
    "config": {},
    "topics": ["bar", "sanitary_safety"],
    "has_answers": false
  }
}