Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Hierarchies API is available since the 2.8.0 Smart Issue Templates version.

Swagger open api macro
displayOperationIdfalse
methodsnone,get,put,post,delete,options,head,patch,trace
validator
defaultModelsExpandDepth1
url
token
defaultModelRenderingexample
filter
password
expandlist
showCommonExtensionsfalse
filename
operations
maxDisplayedTags
attachfalse

...

showExtensionsfalse

...

displayRequestDurationfalse
username
order
openapi: 3.0.3
info:
  title: SITDC REST API
  version: '1.0'
  description: |
    Path structure

    |Path type|Path structure                                       |Description          |
    |---------|-----------------------------------------------------|---------------------|
    |URI      |http://host:port/context/rest/smartissuetemplates/1.0|Root of the SITDC API|
tags:
  - name: Hierarchy
    description: SITDC Hierarchy
    externalDocs:
      description: Find out more about Hierarchies
      url: https://appsdelivered.atlassian.net/wiki/spaces/SIT/pages/38764545/Hierarchies

paths:
  /smartissuetemplates/1.0/hierarchy:
    post:
      tags:
        - Hierarchy
      summary: Add a new Hierarchy
      description: Returns the created Hierarchy
      requestBody:
        required: true
        description: Create a new Hierarchy
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                nodes:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: integer
                      name:
                        type: string
                      isRoot:
                        type: boolean
                      hasChild:
                        type: boolean
                      content:
                        type: string
                      issueTypeId:
                        type: integer
                      projectId:
                        type: integer
                      isSubTask:
                        type: boolean
                      isDynamicReporter:
                        type: boolean
                      isActive:
                        type: boolean
                      isExcluded:
                        type: boolean
                description:
                  type: string
                variableDtos:
                  type: array
                  items:
                    type: object
                    required:
                      - id
                      - name
                      - defaultValue
                      - variableScope
                    properties:
                      id:
                        type: integer
                      name:
                        type: string
                      defaultValue:
                        type: string
                      variableScope:
                        type: string
                        enum:
                          - HIERARCHY
                          - GLOBAL
                          - SYSTEM
                      variableType:
                        type: string
                        enum:
                          - TEXT
                          - USER
                tagDtos:
                  type: array
                  items:
                    type: object
                    required:
                      - id
                    properties:
                      id:
                        type: integer
                owners:
                  type: array
                  items:
                    type: object
                    required:
                      - username
                    properties:
                      username:
                        type: string
      responses:
        '201':
          description: Successfull operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Hierarchy'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  isValid:
                    type: boolean
                  errors:
                    type: object
                    properties:
                      hierarchyErrorMessages:
                        type: string
                    required:
                      - hierarchyErrorMessages
                    additionalProperties:
                      type: array
                      items:
                        type: string
              
  /smartissuetemplates/1.0/hierarchy/{hierarchyId}:
    delete:
      tags:
        - Hierarchy
      summary: Delete a hierarchy
      description: Deletes a Hierarchy by ID
      parameters:
        - name: hierarchyId
          in: path
          required: true
          schema:
            type: integer
      responses:
        '204':
          description: Successfull operation
        '404':
          description: Hierarchy not found or no permission
          content:
            application/json:
              schema:
                type: string
                description: Error message
          
    get:
      tags:
        - Hierarchy
      summary: Get a Hierarchy by ID
      description: Returns the Hierarchy
      parameters:
        - name: hierarchyId
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Successfull operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Hierarchy'
        '404':
          description: Hierarchy not found
          content:
            application/json:
              schema:
                type: string
                description: Error message

  /smartissuetemplates/1.0/hierarchy/pagination:
    post:
      tags:
        - Hierarchy
      summary: Get the paginated hierarchies
      description: Returns a list of paginated, filterd and sorted hierarchies
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                paginationDto:
                  $ref: '#/components/schemas/Pagination'
                filterDtos:
                  type: array
                  items:
                    type: object
                    properties:
                      column:
                        type: string
                        enum:
                          - NAME
                          - OWNER_NAME
                          - PROJECT_ID
                          - ISSUE_TYPE_ID
                          - TAG_ID
                      fieldValues:
                        type: array
                        items:
                          type: string
                  example: [
                    {column: NAME, fieldValues: ["Hierarchy name"]},
                    {column: OWNER_NAME, fieldValues: []},
                    {column: PROJECT_ID, fieldValues: []},
                    {column: ISSUE_TYPE_ID, fieldValues: []},
                    {column: TAG_ID, fieldValues: []}
                  ]
      responses:
        '200':
          description: Successfull operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HierarchyPagination'
        
  /smartissuetemplates/1.0/hierarchy/apply/{hierarchyId}:
    post:
      tags:
        - Hierarchy
      summary: Apply a Hierarchy
      description: Applies a Hierarchy by ID
      parameters:
        - name: hierarchyId
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Successfull operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Hierarchy'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  isValid:
                    type: boolean
                  errors:
                    type: object
                    properties:
                      hierarchyErrorMessages:
                        type: string
                    required:
                      - hierarchyErrorMessages
                    additionalProperties:
                      type: array
                      items:
                        type: string
        '404':
          description: Hierarchy not found
          content:
            application/json:
              schema:
                type: string
                description: Error message
        '500':
          description: applying error
          content:
            application/json:
              schema:
                type: string
                description: Error message


components:
  schemas:
    Hierarchy:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        nodes:
          type: array
          items:
            $ref: '#/components/schemas/Node'
        created:
          type: integer
        updateAuthor:
          $ref: '#/components/schemas/User'
        updateTime:
          type: integer
        description:
          type: string
        issueKeys:
          type: array
          items:
            type: string
        deletedIssueKeys:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
        hierarchyErrors: 
          type: string
        variableDtos:
          type: array
          items:
            $ref: '#/components/schemas/Variable'
        issueLinks:
          type: array
          items:
            $ref: '#/components/schemas/IssueLink'
        nodeLinks:
          type: array
          items:
            $ref: '#/components/schemas/NodeLink'
        tagDtos:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
        alternativeProjectIds:
          type: array
          items:
            type: integer
        owners:
          type: array
          items:
            $ref: '#/components/schemas/User'


    Node:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        isRoot:
          type: boolean
        hasChild:
          type: boolean
        content:
          type: string
        hierarchyId:
          type: integer
        issueTypeId:
          type: integer
        projectId:
          type: integer
        isSubTask:
          type: boolean
        children:
          type: array
          items:
            $ref: '#/components/schemas/Node'
        isDynamicReporter:
          type: boolean
        isActive:
          type: boolean
        state:
          type: boolean
        isExcluded:
          type: boolean
        errors:
          type: array
          items:
            type: string
        warnings:
          type: array
          items:
            enum:
              - REPORTER_WARNING
              - ASSIGNEE_WARNING
              - SCHEDULER_WARNING
        issueKey:
          type: string
        hierarchyVariableDtos:
          type: array
          items:
            $ref: '#/components/schemas/Variable'
        isValidContent:
          type: boolean


    User:
      required:
        - username
      type: object
      properties:
        username:
          type: string
          example: testUser
        userKey:
          type: string
          example: JIRAUSER123
        displayName:
          type: string
          example: Test User
        admin:
          type: boolean
          example: false
        userEmail:
          type: string
          example: user@example.com
        avatarUrl:
          type: string
          
          
    Tag:
      required:
        - id
        - text
      type: object
      properties:
        id:
          type: integer
          example: 1
        text:
          type: string
          example: New Tag
        owner:
          $ref: '#/components/schemas/User'
        created:
          type: integer
          example: 1691694943294
        isNew:
          type: boolean
          example: false
        updateAuthor:
          $ref: '#/components/schemas/User'
        updated:
          type: integer
          example: 1691694943294
          
    
    Variable:
      required:
        - id
        - name
        - defaultValue
      type: object
      properties:
        id:
          type: integer
          example: 10
        name:
          type: string
          example: testVar
        defaultValue:
          type: string
          example: Test variable
        variableType:
          type: string
          enum:
            - TEXT
            - USER
          example: TEXT
        isDynamic:
          type: boolean
          example: false
        owner:
          $ref: '#/components/schemas/User'
        created:
          type: integer
          example: 1691699485337
        updateAuthor:
          $ref: '#/components/schemas/User'
        updateTime:
          type: integer
          example: 1691699485337
        variableScope:
          type: string
          enum:
            - GLOBAL
            - SYSTEM
            - HIERARCHY


    SearchRequest:
      required:
        - paginationDto
      type: object
      properties:
        paginationDto:
          $ref: '#/components/schemas/Pagination'
        filterDtos:
          type: array
          items:
            $ref: '#/components/schemas/Filter'

          
    Pagination:
      required:
        - limin
        - offset
        - column
        - order
      type: object
      properties:
        limit:
          type: integer
          example: 10
        offset:
          type: integer
          example: 20
        column:
          type: string
          enum:
            - name
            - usages
            - created
            - createdBy
            - changed
            - changedBy
            - scope
            - is_global
          example: name
        order:
          type: string
          enum:
            - ASC
            - DESC
        currentUser:
          type: string
          example: JIRAUSER123


    Filter:
      required:
        - column
        - fieldValues
      type: object
      properties:
        column:
          type: string
          enum:
            - PROJECT_ID
            - CAN_APPLY
            - NAME
            - TAG_ID
            - SCOPE_ID
            - AVAILABLE
            - OWNER_NAME
            - ISSUE_TYPE_ID
            - GROUP_ID
            - USER_ID
          example: NAME
        fieldValues:
          type: array
          items:
            type: string
          example: [Some template name]


    HierarchyPagination:
      type: object
      properties:
        hierarchies:
          type: array
          items:
            $ref: '#/components/schemas/Hierarchy'
        numHierarchies:
          type: integer
          example: 10
        requestParam:
          $ref: "#/components/schemas/Pagination"
        filterDtos:
          type: array
          items:
            $ref: "#/components/schemas/Filter"


    IssueLink:
      type: object
      properties:
        id:
          type: integer
        linkType:
          type: integer
          format: int64
        comment:
          type: string
        nodeId:
          type: integer
        issueKey:
          type: string
        direction:
          enum:
            - FROM_ISSUE_TO_NODE
            - FROM_NODE_TO_ISSUE


    NodeLink:
      type: object
      properties:
        id:
          type: integer
        linkType:
          type: integer
          format: int64
        comment:
          type: string
        sourceNodeId:
          type: integer
        destinationNodeId:
          type: integer