openapi: 3.1.0
info:
  title: TMT API
  description: API working with Test folders in TMT
  version: 1.0.0
paths:
  /api/v2/rpc (GET_TASK_REQUEST):
    post:
      summary: Get task request
      description: >
        Get a task request document by its document reference using the
        GET_TMT_DOCUMENT operation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetTmtDocumentRequest'
              examples:
                $ref: example/GET_TASK_REQUEST-request.json
      responses:
        '200':
          description: GET_TMT_DOCUMENT result containing the task request document
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTmtDocumentResponse'
                examples:
                  $ref: example/GET_TASK_REQUEST-response.json
security:
  - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    TaskRequestDocumentResponse:
      allOf:
        - $ref: '#/components/schemas/RpcResult'
        - type: object
          properties:
            result:
              allOf:
                - $ref: '#/components/schemas/TaskRequestDocumentResult'
    TaskRequestDocumentResult:
      allOf:
        - $ref: '#/components/schemas/DocumentResult'
        - type: object
        - properties:
            document:
              description: Task request document
              $ref: '#/components/schemas/TaskRequestDocument'
    TaskRequestDocument:
      type: object
      properties:
        Root:
          $ref: '#/components/schemas/Root'
        meta:
          $ref: '#/components/schemas/Meta'
    Root:
      type: object
      properties:
        General:
          type: object
          description: General information about the project version.
          properties:
            Status:
              type: string
              description: The status of the operation associated with this task request
              enum:
                - NEW
                - RUNNING
                - DONE
                - ERROR
            Visibility:
              type: string
              description: Visibility status
              enum:
                - SHOW
                - HIDE
            Type:
              type: string
              description: The type of action being performed
              enum:
                - GENERATE_REPORT
                - CREATE_PROJECT_VERSION
                - COPY_TEST_RUN
                - CLOSE_TEST_RUN
                - GENERATE_CSV_REPORT
                - SET_TEST_CASE_PROPERTY
                - DELETE_TEST_SUITE
                - SET_TEST_SUITE_PROPERTY
                - SET_TEST_EXECUTION_PROPERTY
                - UPDATE_PIN_STATUS
                - COPY_TEST_FOLDER
                - MOVE_TEST_FOLDER
                - DELETE_PROJECT_VERSION
                - DELETE_PINNED_DOCUMENTS
                - RESET_TEST_SUITES_ORDER
                - HANDLE_AFTER_DELETING_USER
                - COPY_ITEMS_IN_TEST_SUITE
                - MOVE_ITEMS_IN_TEST_SUITE
                - EXPORT_QF_DATA_STRUCTURE
                - EXPORT_QF_DATA_DETAIL
                - CREATE_RUN_BY_RISK_LEVEL
                - REBUILD_RISK_LEVEL_DOCUMENTS
                - ADD_TEST_CASES_TO_RUN_ASYNC
                - SAVE_TEST_EXECUTIONS_ASYNC
                - DELETE_PROJECT
                - COPY_TEST_SUITE
            TenantId:
              type: string
              description: Identifier for the tenant.
            ProjectId:
              type: string
              description: Identifier for the project.
            SubprojectId:
              type: string
              description: Identifier for the subproject.
            ProjectVersionNumber:
              type: string
              description: The version number of the project.
        DisplayFields:
          type: object
          description: Additional fields for display purposes.
          properties:
            EstimatedTime:
              type: integer
              description: Estimated time in seconds.
        Metadata:
          $ref: '#/components/schemas/Metadata'
        Parameters:
          type: array
          description: A list of parameters associated with the request.
          items:
            type: object
            properties:
              Key:
                type: string
                description: The key of the parameter.
              Value:
                type: string
                description: The value of the parameter in a form of an JSON string.
    RpcRequestWithIdAndJsonRpc:
      type: object
      required:
        - id
        - jsonrpc
      properties:
        id:
          type: string
          description: id of the operation
        jsonrpc:
          type: string
          description: must be 2.0
          example: '2.0'
    GetTmtDocumentRequest:
      allOf:
        - $ref: '#/components/schemas/RpcRequestWithIdAndJsonRpc'
        - type: object
          required:
            - method
            - params
          properties:
            method:
              type: string
              description: GET_TMT_DOCUMENT
            params:
              required:
                - docRef
              properties:
                docRef:
                  type: string
                  description: document reference
      examples:
        - id: GET_TMT_DOCUMENT-1
          method: GET_TMT_DOCUMENT
          jsonrpc: '2.0'
          params:
            docRef: TaskRequest-dm/e9082a15-bb40-4a14-b319-4c9510d3ca0c
    RpcResult:
      type: object
      properties:
        jsonrpc:
          type: string
          description: request jsonrpc version
        id:
          type: string
          description: id of the operation
        result:
          type: object
    GetTmtDocumentResponse:
      allOf:
        - $ref: '#/components/schemas/RpcResult'
        - type: object
          properties:
            result:
              type: object
              required:
                - docRef
                - documentModelName
                - document
              properties:
                docRef:
                  type: string
                  description: Document reference of the returned document.
                documentModelName:
                  type: string
                  description: Document Model name of the returned document.
                document:
                  type: object
                  description: >-
                    Document content. Includes a `Root` object with the document
                    model fields and a `__meta` object with document metadata.
      examples:
        - jsonrpc: '2.0'
          id: GET_TMT_DOCUMENT-1
          result:
            docRef: TaskRequest-dm/e9082a15-bb40-4a14-b319-4c9510d3ca0c
            documentModelName: TaskRequest-dm
            document:
              Root:
                DisplayFields:
                  EstimatedTime: 1500
                General:
                  ProjectId: P_6
                  ProjectVersionNumber: 5.0.0
                  Status: DONE
                  SubprojectId: _
                  TenantId: T_1
                  Type: GENERATE_REPORT
                  Visibility: SHOW
                Metadata:
                  CreatedBy: tmtdoc
                  CreatedOn: 1778128437285
                  DisplayCreatedOn: '2026-05-07T04:33:57'
                  DisplayEditedOn: '2026-05-07T04:34:01'
                  EditedBy: tmtdoc
                  EditedOn: 1778128441858
                Parameters:
                  - Key: lockingUsername
                    Value: >-
                      tmtdoc###Chrome-147.0.0.0-Mac
                      OS-10.15.7-Apple-Macintosh-false###46f2a07a-84b1-4c50-b28f-4efb0edf92be
                  - Key: operation
                    Value: PRINT_BY_DOCUMENT_DOC_REF
                  - Key: documentDocRef
                    Value: TestCase-dm/63227df9-2d7d-4ef6-b400-6d26a9ac788d
              __meta:
                createdAt: '2026-05-07T04:33:57'
                creator: SYSTEM
                docRef: TaskRequest-dm/e9082a15-bb40-4a14-b319-4c9510d3ca0c
                modelReference: TaskRequest-dm
                modelVersion: null
                modifiedAt: '2026-05-07T04:34:01'
                modifier: SYSTEM
    DocumentResult:
      type: object
      properties:
        docRef:
          type: string
          description: document reference
        documentModelName:
          type: string
          description: model name
        document:
          type: object
    Metadata:
      type: object
      readOnly: true
      description: >-
        \[**Read only**] Metadata of the document. It will be ignored if
        included in the request of the add/update operations (e.g ADD_DOCUMENT,
        MODIFY_DOCUMENT)
      properties:
        CreatedBy:
          type: string
          description: who created this project
        DisplayCreatedOn:
          type: string
          format: date-time
          description: creation time in the human readable format (UTC time zone)
        CreatedOn:
          type: integer
          description: creation time of the project
        EditedBy:
          description: the last person who edited this project document
          type: string
        DisplayEditedOn:
          type: string
          format: date-time
          description: edited time in the human readable format (UTC time zone)
        EditedOn:
          description: the last edited time of the project
          type: integer
    Meta:
      type: object
      readOnly: true
      description: >-
        \[**Read only**] Contain the meta data information of the document. **It
        will be ignored if included in the request of the update operations**
        (e.g MODIFY_DOCUMENT)
      properties:
        creator:
          type: string
          readOnly: true
          description: The user who created the document
        modifier:
          type: string
          readOnly: true
          description: The user who last modified the document
        docRef:
          type: string
          description: Reference to the document
        modelReference:
          type: string
          description: Reference to the model associated with the document
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the document was created
        modifiedAt:
          type: string
          format: date-time
          description: Timestamp when the document was last modified
        modelVersion:
          type: string
          nullable: true
          description: Version of the model associated with the document
