Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
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
displayRequestDurationfalse
showExtensionsfalse
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: Template
    description: SITDC Template
    externalDocs:
      description: Find out more about Templates
      url: https://appsdelivered.atlassian.net/wiki/spaces/SIT/pages/2490395/Templates

paths:
  /smartissuetemplates/1.0/template:
    post:
      tags:
        - Template
      summary: Add a new Template
      description: Returns the created Template
      requestBody:
        description: Create a new Template
        content:
          application/json:
            schema:
              required:
                - name
                - content
                - owners
                - scopeDto
                - availableFor
              type: object
              properties:
                name:
                  type: string
                  example: Test Template
                content:
                  type: string
                  example: 'pid=10000&issuetype=10000&summary=&reporter=admin&dnd-dropzone=&duedate=&description=&assignee=-1&priority=3'
                  description: Stringified content of Create Issue dialog
                availableFor:
                  type: string
                  example: SCOPE
                  enum:
                    - OWNER
                    - SCOPE
                contentVersion:
                  type: string
                  example: V2
                  enum:
                    - V2
                description:
                  type: string
                  example: Just test template
                isPublic:
                  type: boolean
                  example: true
                  description: true if availableFor equals SCOPE, otherwise false
                issueKey:
                  type: string
                isDefault:
                  type: boolean
                  example: false
                isFavorite:
                  type: boolean
                  example: false
                scopeDto:
                  $ref: '#/components/schemas/Scope'
                owners:
                  type: array
                  items:
                    $ref: '#/components/schemas/User'
                tagDtos:
                  type: array
                  items:
                    $ref: '#/components/schemas/Tag'
                variableDtos:
                  type: array
                  items:
                    $ref: '#/components/schemas/Variable'

        required: true
      responses:
        '201':
          description: Successfull creation
          content:
            applicatoin/json:
              schema:
                $ref: '#/components/schemas/Template'
        '400':
          description: Default template already exists
          content:
            application/json:
              schema:
                type: string
                description: Error message
        '403':
          description: Permission error
          content:
            application/json:
              schema:
                type: string
                description: Error message
        '500':
          description: Validation error
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                  description: Error message

    put:
      tags:
        - Template
      summary: Update a Template
      description: Updates a Template
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatingTemplate'
      responses:
        '200':
          description: Successfull operation
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                oneOf:
                  - type: string
                    description: Error message
                  - type: array
                    items:
                      type: string
                      description: Error message
        '403':
          description: Permission error
          content:
            application/json:
              schema:
                type: string
                description: Error message


  /smartissuetemplates/1.0/template/attachment/{templateId}:
    get:
      tags:
        - Template
      summary: Get the template by ID
      description: Returns a single template
      parameters:
        - name: templateId
          in: path
          description: ID of a template to return
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Successfull operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
        '404':
          description: Template not found

  /smartissuetemplates/1.0/template/pagination:
    post:
      tags:
        - Template
      summary: Get the paginated templates
      description: Returns a list of paginated, filterd and sorted templates
      requestBody:
        required: true
        content:
          application/json:
            schema:
                type: object
                properties:
                  paginationDto:
                    $ref: '#/components/schemas/Pagination'
                  filterDtos:
                    type: array
                    items:
                      $ref: '#/components/schemas/Filter'
      responses:
        '200':
          description: Successfull operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplatePagination'

  /smartissuetemplates/1.0/template/duplicate:
    post:
      tags:
        - Template
      summary: Duplicate a template
      description: Returns a duplicated template
      requestBody:
        required: true
        content:
          application/json:
            schema:
                required:
                - id
                - name
                - owner
                - owners
                - scopeDto
                type: object
                properties:
                  id:
                    type: integer
                  name:
                    type: string
                  scopeDto:
                    $ref: '#/components/schemas/Scope'
                  owners:
                    type: array
                    items:
                      $ref: '#/components/schemas/User'
                  owner:
                    $ref: '#/components/schemas/User'
      responses:
        '200':
          description: Successfull duplication
          content:
            application/json:
              schema:
                type: integer
                example: 8
                description: ID of a duplicate
        '403':
          description: Permission error
          content:
            application/json:
              schema:
                type: string
                description: Error message
        '500':
          description: Validation error
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                  description: Error message

  /smartissuetemplates/1.0/template/{templateId}:
    delete:
      tags:
        - Template
      summary: Delete a Template
      description: Deletes a template by its ID
      parameters:
        - name: templateId
          in: path
          description: ID of a Template to delete
          required: true
          schema:
            type: stringinteger
      responses:
        '204':
          description: Successfull deletion
        '400':
          description: Invalid Template ID supplied
        '500':
          description: Template not found or no permission to delete a template

  /smartissuetemplates/1.0/template/apply/{templateId}:
    post:
      tags:
        - Template
      summary: Apply a Template
      description: Applies a Template by ID
      parameters:
        - name: templateId
          in: path
          description: ID of a Template to apply
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Successfull applying
          content:
            application/json:
              schema:
                type: string
                description: Issue key
        '403':
          description: No permmission
          content:
            application/json:
              schema:
                type: string
                description: Error message
        '404':
          description: Template not found
          content:
            application/json:
              schema:
                type: string
                description: Error message
    

components:
  schemas:
    Template:
      required:
        - id
        - name
        - content
        - owners
        - scopeDto
        - availableFor
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
          example: Test Template
        content:
          type: string
          example: 'pid=10000&issuetype=10000&summary=&reporter=admin&dnd-dropzone=&duedate=&description=&assignee=-1&priority=3'
          description: Stringified content of Create Issue dialog
        owner:
          $ref: '#/components/schemas/User'
        availableFor:
          type: string
          example: SCOPE
          enum:
            - OWNER
            - SCOPE
        contentVersion:
          type: string
          example: V2
          enum:
            - V2
        description:
          type: string
          example: Just test template
        isPublic:
          type: boolean
          example: true
          description: true if availableFor equals SCOPE, otherwise false
        issueKey:
          type: string
          example: TP-1
        created:
          type: integer
          example: 1691696567217
          description: Integer of seconds since midnight, January 1, 1970
        updateAuthor:
          $ref: '#/components/schemas/User'
        updateTime:
          type: integer
          example: 1691696567217
        usages:
          type: integer
          example: 0
        isDefault:
          type: boolean
          example: false
        isFavorite:
          type: boolean
          example: false
        scopeDto:
          $ref: '#/components/schemas/Scope'
        owners:
          type: array
          items:
            $ref: '#/components/schemas/User'
        tagDtos:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
        variableDtos:
          type: array
          items:
            $ref: '#/components/schemas/Variable'
        projectId:
          type: string
          example: 10000
        issueTypeId:
          type: string
          example: 10010
        projectIds:
          type: array
          items:
            type: integer
        issueTypeIds:
          type: array
          items:
            type: integer

      
    UpdatingTemplate:
      required:
        - templateDto
        - newOwners
      type: object
      properties:
        templateDto:
          required:
            - id
            - name
            - content
            - owner
            - owners
            - scopeDto
            - availableFor
            - contentVersion
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
              example: Test Template
            content:
              type: string
              example: 'pid=10000&issuetype=10000&summary=&reporter=admin&dnd-dropzone=&duedate=&description=&assignee=-1&priority=3'
              description: Stringified content of Create Issue dialog
            owner:
              $ref: '#/components/schemas/User'
            availableFor:
              type: string
              example: SCOPE
              enum:
                - OWNER
                - SCOPE
            contentVersion:
              type: string
              example: V2
              enum:
                - V2
            description:
              type: string
              example: Just test template
            isPublic:
              type: boolean
              example: true
              description: true if availableFor equals SCOPE, otherwise false
            issueKey:
              type: string
            isDefault:
              type: boolean
              example: false
            isFavorite:
              type: boolean
              example: false
            scopeDto:
              $ref: '#/components/schemas/Scope'
            owners:
              type: array
              items:
                $ref: '#/components/schemas/User'
            tagDtos:
              type: array
              items:
                $ref: '#/components/schemas/Tag'
            variableDtos:
              type: array
              items:
                $ref: '#/components/schemas/Variable'
        newOwners:
          type: array
          items:
            $ref: '#/components/schemas/User'
        
          
    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
          
          
    Scope:
      type: object
      properties:
        id:
          type: integer
          example: 1
        name:
          type: string
          example: GLOBAL
        owner:
          $ref: '#/components/schemas/User'
        isGlobalIssueType:
          type: boolean
          example: true
        isGlobalIssueProject:
          type: boolean
          example: true
        isGlobalIssueGroup:
          type: boolean
          example: true
        isGlobalIssueUser:
          type: boolean
          example: true
        projectIds:
          type: array
          items:
            type: integer
          example: []
        issueTypeIds:
          type: array
          items:
            type: integer
          example: [-1]
        groupNames:
          type: array
          items:
            type: string
          example: []
        userNames:
          type: array
          items:
            type: string
          example: []
        owners:
          type: array
          items:
            $ref: '#/components/schemas/User'
        templateDtos:
          type: array
          items:
            $ref: '#/components/schemas/Template'
        countTemplates:
          type: integer
          
    
    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:
        - 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:
            - CAN_APPLY
            - NAME
            - TAG_ID
            - SCOPE_ID
            - AVAILABLE
            - OWNER_NAME
        fieldValues:
          type: array
          items:
            type: string
      example: [
        {column: CAN_APPLY, fieldValues: ["false"]}, 
        {column: NAME, fieldValues: []},
        {column: TAG_ID, fieldValues: []},
        {column: SCOPE_ID, fieldValues: []},
        {column: AVAILABLE, fieldValues: [ALL]},
        {column: OWNER_NAME, fieldValues: []},
      ]


    TemplatePagination: 
      type: object
      properties:
        templates:
          type: array
          items:
            $ref: '#/components/schemas/Template'
        numTemplates:
          type: integer
          example: 10
        requestParam:
          $ref: "#/components/schemas/Pagination"
        filterDtos:
          type: array
          items:
            $ref: "#/components/schemas/Filter"