Charthop question API

The question API from Charthop — 2 operation(s) for question.

OpenAPI Specification

charthop-question-api-openapi.yml Raw ↑
swagger: '2.0'
info:
  description: REST API for ChartHop
  version: V1.0.0
  title: ChartHop access question API
  contact:
    name: ChartHop
    url: https://www.charthop.com
    email: support@charthop.com
host: localhost
schemes:
- https
- http
consumes:
- application/json
produces:
- application/json
tags:
- name: question
paths:
  /v1/org/{orgId}/question:
    get:
      tags:
      - question
      summary: Return all questions in the organization paginated
      operationId: findQuestions
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: orgId
        in: path
        description: Org identifier (either id or slug)
        required: true
        type: string
      - name: from
        in: query
        description: Question id to start paginating from
        required: false
        type: string
      - name: limit
        in: query
        description: Number of results to return
        required: false
        type: integer
        format: int32
      - name: ids
        in: query
        description: Comma separated Question Ids to find
        required: false
        type: string
      responses:
        '200':
          description: successful operation
          schema:
            $ref: '#/definitions/ResultsQuestion'
        '400':
          description: bad request
        '401':
          description: not authorized
        '404':
          description: not found
    post:
      tags:
      - question
      summary: Create a question
      operationId: createQuestion
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: orgId
        in: path
        description: Org identifier (either id or slug)
        required: true
        type: string
      - name: body
        in: body
        description: Question data to create
        required: true
        schema:
          $ref: '#/definitions/CreateQuestion'
      responses:
        '201':
          description: question created
          schema:
            $ref: '#/definitions/Question'
        '400':
          description: invalid data
        '401':
          description: not authorized
        '403':
          description: permission denied
        '404':
          description: org not found
  /v1/org/{orgId}/question/{questionId}:
    get:
      tags:
      - question
      summary: Return a particular question by id
      operationId: getQuestion
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: orgId
        in: path
        description: Org identifier (either id or slug)
        required: true
        type: string
      - name: questionId
        in: path
        description: Question id
        required: true
        type: string
      responses:
        '200':
          description: success
          schema:
            $ref: '#/definitions/Question'
        '400':
          description: bad request
        '404':
          description: not found
    patch:
      tags:
      - question
      summary: Update an existing question
      operationId: updateQuestion
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: orgId
        in: path
        description: Org identifier (either id or slug)
        required: true
        type: string
      - name: questionId
        in: path
        description: Question id
        required: true
        type: string
      - name: body
        in: body
        description: Question data to update
        required: true
        schema:
          $ref: '#/definitions/UpdateQuestion'
      responses:
        '204':
          description: question updated
        '400':
          description: invalid data
        '401':
          description: not authorized
        '403':
          description: permission denied
        '404':
          description: not found
    delete:
      tags:
      - question
      summary: Delete a question
      operationId: deleteQuestion
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: orgId
        in: path
        description: Org identifier (either id or slug)
        required: true
        type: string
      - name: questionId
        in: path
        description: Question id
        required: true
        type: string
      responses:
        '204':
          description: question deleted
        '400':
          description: invalid data
        '401':
          description: not authorized
        '403':
          description: permission denied
        '404':
          description: not found
definitions:
  AccessAction:
    type: object
    required:
    - action
    properties:
      action:
        type: string
      fields:
        type: array
        uniqueItems: true
        items:
          type: string
      types:
        type: array
        uniqueItems: true
        items:
          type: string
  ResultsAccess:
    type: object
    required:
    - allowed
    properties:
      ids:
        type: array
        uniqueItems: true
        items:
          type: string
          example: 588f7ee98f138b19220041a7
      allowed:
        type: array
        uniqueItems: true
        items:
          $ref: '#/definitions/AccessAction'
  EnumValue:
    type: object
    required:
    - name
    - label
    properties:
      name:
        type: string
        description: enum value name
      label:
        type: string
        description: enum value label
      color:
        type: string
        description: color of property
        pattern: ^#[a-f0-9]{6}$
      expr:
        type: string
        description: computed expression, for ENUM_EXPR type
      num:
        type: number
        description: numeric value, for ENUM_SCALE type
      sort:
        type: integer
        format: int32
        description: sort order
      rank:
        type: integer
        format: int32
        description: rank order, if selected in rank order
      id:
        type: string
        description: unique identifier for enum
        example: 588f7ee98f138b19220041a7
      labelTr:
        description: translations for the label
        $ref: '#/definitions/Translations'
  ResultsQuestion:
    type: object
    required:
    - data
    properties:
      data:
        type: array
        items:
          $ref: '#/definitions/Question'
      next:
        type: string
      access:
        type: array
        items:
          $ref: '#/definitions/ResultsAccess'
  Translations:
    type: object
    required:
    - values
    properties:
      values:
        type: object
        additionalProperties:
          type: string
  Question:
    type: object
    required:
    - id
    - question
    - type
    properties:
      id:
        type: string
        description: globally unique id
        example: 588f7ee98f138b19220041a7
      orgId:
        type: string
        description: parent organization id (empty if global)
        example: 588f7ee98f138b19220041a7
      question:
        type: string
        description: text of the question
        example: What is your favorite color?
      questionTr:
        description: translations for the question text
        $ref: '#/definitions/Translations'
      fieldId:
        type: string
        description: if the question is linked to a field, the id of that field. Any question responses will be automatically saved to the field
        example: 588f7ee98f138b19220041a7
      type:
        type: string
        description: datatype of the question
        enum:
        - ADDRESS
        - AUDIO
        - BOOLEAN
        - COMP
        - COMPOUND
        - COMP_BAND
        - CONTACTS
        - CURRENCY
        - DATE
        - DECIMAL
        - ELAPSED_DAYS
        - ELAPSED_MONTHS
        - ELAPSED_YEARS
        - EMAIL
        - ENUM
        - ENUM_EXPR
        - ENUM_MULTI
        - ENUM_SCALE
        - EXPR
        - FILE
        - GROUP
        - GROUPS
        - GROUP_ASSIGNMENTS
        - GROUP_TYPE
        - GROUP_POSITION_ASSIGNMENTS
        - IMAGE
        - INTEGER
        - JOB
        - JOB_CODE
        - JOBS
        - JOB_TIER
        - LIST
        - MAP
        - MONEY
        - NAME
        - OBJECT
        - PAY_INTERVAL
        - PERCENT
        - PERSON
        - PERSONS
        - PHONE
        - STOCKGRANT
        - STRING
        - TABLE_REF
        - TEXT
        - TIMEOFF
        - TIMESTAMP
        - TRACKED_GROUP
        - URL
        - USER
        - VARIABLE_COMP
        - VARIABLE_COMPS
      plural:
        type: string
        description: plural type of the question datatype (either SINGLE, LIST, or SET)
        enum:
        - SINGLE
        - LIST
        - SET
      values:
        type: array
        description: possible values (enum type only)
        items:
          $ref: '#/definitions/EnumValue'
      places:
        type: integer
        format: int32
        description: number of decimal places for numeric values
      options:
        description: validation options
        $ref: '#/definitions/FieldOptions'
      createId:
        type: string
        description: created by user id
        example: 588f7ee98f138b19220041a7
      createBehalfId:
        type: string
        description: created on behalf of user id
        example: 588f7ee98f138b19220041a7
      createAttribution:
        $ref: '#/definitions/Attribution'
      createAt:
        type: string
        description: created timestamp
        example: '2017-01-24T13:57:52Z'
      updateId:
        type: string
        description: last updated by user id
        example: 588f7ee98f138b19220041a7
      updateBehalfId:
        type: string
        description: last updated on behalf of user id
        example: 588f7ee98f138b19220041a7
      updateAttribution:
        $ref: '#/definitions/Attribution'
      updateAt:
        type: string
        description: last updated timestamp
        example: '2017-01-24T13:57:52Z'
      deleteId:
        type: string
        description: deleted by user id
        example: 588f7ee98f138b19220041a7
      deleteBehalfId:
        type: string
        description: deleted on behalf of user id
        example: 588f7ee98f138b19220041a7
      deleteAttribution:
        $ref: '#/definitions/Attribution'
      deleteAt:
        type: string
        description: deleted timestamp
        example: '2017-01-24T13:57:52Z'
  Attribution:
    type: object
    properties:
      principalUserId:
        type: string
        example: 588f7ee98f138b19220041a7
      agentUserIds:
        type: array
        items:
          type: string
          example: 588f7ee98f138b19220041a7
      eventId:
        type: string
        example: 588f7ee98f138b19220041a7
      aiChatId:
        type: string
        example: 588f7ee98f138b19220041a7
      aiToolUseId:
        type: string
      channel:
        type: string
        enum:
        - WEB
        - MOBILE
        - SLACK
        - TEAMS
        - MCP
  FieldOptions:
    type: object
    properties:
      min:
        type: string
        description: minimum value, for numeric and date fields
      max:
        type: string
        description: maximum value, for numeric and date fields
      minItems:
        type: integer
        format: int32
      maxItems:
        type: integer
        format: int32
      stackRank:
        type: boolean
      step:
        type: number
      enableEditDialog:
        type: boolean
      requiredJobField:
        type: boolean
      excludeTargetPersonId:
        type: boolean
      maxLength:
        type: integer
        format: int32
      readOnly:
        type: boolean
      includeFormer:
        type: boolean
      effectiveDated:
        type: boolean
      unique:
        type: boolean
      required:
        type: boolean
  CreateQuestion:
    type: object
    required:
    - question
    properties:
      orgId:
        type: string
        description: parent organization id (empty if global)
        example: 588f7ee98f138b19220041a7
      question:
        type: string
        description: text of the question
        example: What is your favorite color?
      questionTr:
        description: translations for the question text
        $ref: '#/definitions/Translations'
      fieldId:
        type: string
        description: if the question is linked to a field, the id of that field. Any question responses will be automatically saved to the field
        example: 588f7ee98f138b19220041a7
      type:
        type: string
        description: datatype of the question
        enum:
        - ADDRESS
        - AUDIO
        - BOOLEAN
        - COMP
        - COMPOUND
        - COMP_BAND
        - CONTACTS
        - CURRENCY
        - DATE
        - DECIMAL
        - ELAPSED_DAYS
        - ELAPSED_MONTHS
        - ELAPSED_YEARS
        - EMAIL
        - ENUM
        - ENUM_EXPR
        - ENUM_MULTI
        - ENUM_SCALE
        - EXPR
        - FILE
        - GROUP
        - GROUPS
        - GROUP_ASSIGNMENTS
        - GROUP_TYPE
        - GROUP_POSITION_ASSIGNMENTS
        - IMAGE
        - INTEGER
        - JOB
        - JOB_CODE
        - JOBS
        - JOB_TIER
        - LIST
        - MAP
        - MONEY
        - NAME
        - OBJECT
        - PAY_INTERVAL
        - PERCENT
        - PERSON
        - PERSONS
        - PHONE
        - STOCKGRANT
        - STRING
        - TABLE_REF
        - TEXT
        - TIMEOFF
        - TIMESTAMP
        - TRACKED_GROUP
        - URL
        - USER
        - VARIABLE_COMP
        - VARIABLE_COMPS
      plural:
        type: string
        description: plural type of the question datatype (either SINGLE, LIST, or SET)
        enum:
        - SINGLE
        - LIST
        - SET
      values:
        type: array
        description: possible values (enum type only)
        items:
          $ref: '#/definitions/EnumValue'
      places:
        type: integer
        format: int32
        description: number of decimal places for numeric values
      options:
        description: validation options
        $ref: '#/definitions/FieldOptions'
  UpdateQuestion:
    type: object
    properties:
      question:
        type: string
        description: text of the question
        example: What is your favorite color?
      questionTr:
        description: translations for the question text
        $ref: '#/definitions/Translations'
      fieldId:
        type: string
        description: if the question is linked to a field, the id of that field. Any question responses will be automatically saved to the field
        example: 588f7ee98f138b19220041a7
      type:
        type: string
        description: datatype of the question
        enum:
        - ADDRESS
        - AUDIO
        - BOOLEAN
        - COMP
        - COMPOUND
        - COMP_BAND
        - CONTACTS
        - CURRENCY
        - DATE
        - DECIMAL
        - ELAPSED_DAYS
        - ELAPSED_MONTHS
        - ELAPSED_YEARS
        - EMAIL
        - ENUM
        - ENUM_EXPR
        - ENUM_MULTI
        - ENUM_SCALE
        - EXPR
        - FILE
        - GROUP
        - GROUPS
        - GROUP_ASSIGNMENTS
        - GROUP_TYPE
        - GROUP_POSITION_ASSIGNMENTS
        - IMAGE
        - INTEGER
        - JOB
        - JOB_CODE
        - JOBS
        - JOB_TIER
        - LIST
        - MAP
        - MONEY
        - NAME
        - OBJECT
        - PAY_INTERVAL
        - PERCENT
        - PERSON
        - PERSONS
        - PHONE
        - STOCKGRANT
        - STRING
        - TABLE_REF
        - TEXT
        - TIMEOFF
        - TIMESTAMP
        - TRACKED_GROUP
        - URL
        - USER
        - VARIABLE_COMP
        - VARIABLE_COMPS
      plural:
        type: string
        description: plural type of the question datatype (either SINGLE, LIST, or SET)
        enum:
        - SINGLE
        - LIST
        - SET
      values:
        type: array
        description: possible values (enum type only)
        items:
          $ref: '#/definitions/EnumValue'
      places:
        type: integer
        format: int32
        description: number of decimal places for numeric values
      options:
        description: validation options
        $ref: '#/definitions/FieldOptions'