openapi: 3.0.3

info:
  title: Disbursements
  description: "For retrieving Disbursements. For information of how to construct requests utilising fieldsets, sorting, paging, filters, and '*includes*', please refer to the API Developer Portal. E&OE."
  version: "1.0"

externalDocs:
  description: API Developer Portal - Constructing API Requests
  url: https://docs.actionstep.com/api-requests/

paths:
  '/disbursements':
    get:
      description: Returns a collection of disbursements. For information on how to construct requests filtering by various properties, please refer to the API Developer Portal.
      tags:
        - Disbursements
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedDisbursements'

    post:
      description: Create a new disbursement.
      tags:
        - Disbursements
      requestBody:
        $ref: '#/components/requestBodies/CreateDisbursement'
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Disbursement'

  '/disbursements/{id}':
    get:
      description: Returns a single disbursement.
      tags:
        - Disbursements
      parameters:
        - name: id
          in: path
          description: Unique identifier for a disbursement.
          required: true
          schema:
            type: integer
          example: 7630
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Disbursement'

    put:
      description: Updates a disbursement
      tags:
        - Disbursements
      requestBody:
        $ref: '#/components/requestBodies/UpdateDisbursement'
      parameters:
        - name: id
          in: path
          description: Unique identifier for a disbursement.
          required: true
          schema:
            type: integer
          example: 7630
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Disbursement'

    delete:
      description: Deletes a disbursement.
      tags:
        - Disbursements
      parameters:
        - name: id
          in: path
          description: Unique identifier for a disbursement.
          required: true
          schema:
            type: integer
          example: 7630
      responses:
        '204':
          description: No content.

components:
  schemas:
    PagedDisbursements:
      type: object
      properties:
        disbursements:
          type: array
          items:
            $ref: '#/components/schemas/Disbursement'
        meta:
          $ref: '#/components/schemas/PageMetaData'

    PageMetaData:
      type: object
      properties:
        paging:
          $ref: '#/components/schemas/PagingData'

    PagingData:
      type: object
      properties:
        participants:
          $ref: '#/components/schemas/DisbursementsPageData'

    DisbursementsPageData:
      type: object
      properties:
        recordCount:
          description: The total number of disbursements returned by the underlying query.
          type: integer
          example: 2317
        pageCount:
          description: The total number of pages generated by the underlying query.
          type: integer
          example: 47
        page:
          description: The page number for this page of disbursements.
          type: integer
          example: 2
        pageSize:
          description: Page size.
          type: integer
          example: 50
        prevPage:
          description: A URL to the previous page of disbursements.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/disbursements?page=1
        nextPage:
          description: A URL to the next page of disbursements.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/disbursements?page=3

    Disbursement:
      type: object
      properties:
        id:
          description: Unique identifier for the disbursement.
          example: 529
          type: integer
        date:
          description: The date of the disbursement.
          example: 23-May-1987
          type: string
          format: date
        description:
          description: A description for the disbursement.
          example: Photocopying
          type: string
        quantity:
          description: The unit quantity for the disbursement.
          example: 1.0
          type: number
        unitPrice:
          description: The unit price for the disbursement.
          example: 24.50
          type: number
        unitPriceIncludesTax:
          description: Indicates if the unit price includes sales tax.
          enum:
            - T
            - F
          example: T
          type: string
        utbmsExpenseCode:
          description: A UTBMS code for the disbursement.
          example: PH383
          type: string
        importExternalReference:
          description: Meta data property to hold an external reference. Typically used when importing data into Actionstep.
          example: U37303-73730
          type: string
        enteredTimestamp:
          description: Date and time of record creation.
          example: 2019-11-05T14:23:48+13:00
          type: string
          format: timestamp
        links:
          $ref: '#/components/schemas/DisbursementLinks'

    DisbursementLinks:
      type: object
      properties:
        action:
          description: Unique identifier of the matter to which the disbursement is associated.
          example: 64
          format: integer
          type: string
        enteredByParticipant:
          description: Unique identifier of the user who entered the disbursement.
          example: 964
          format: integer
          type: string
        uom:
          description: Unique identifier for the Unit of Measure used by the disbursement.
          example: 1748
          format: integer
          type: string
        taxCode:
          description: Unique identifier for the tax code applicable to the disbursement.
          example: 92
          format: integer
          type: string
        incomeAccount:
          description: Unique identifier for the income account applicable to this disbursement.
          example: 482
          format: integer
          type: string

    CreateDisbursement:
      type: object
      required:
        - date
        - description
        - quantity
        - unitPrice
        - unitPriceIncludesTax
      properties:
        date:
          description: The date of the disbursement.
          example: 23-May-1987
          type: string
          format: date
        description:
          description: A description for the disbursement.
          example: Photocopying
          type: string
        quantity:
          description: The unit quantity for the disbursement.
          example: 1.0
          type: number
        unitPrice:
          description: The unit price for the disbursement.
          example: 24.50
          type: number
        unitPriceIncludesTax:
          description: Indicates if the unit price includes sales tax.
          enum:
            - T
            - F
          example: T
          type: string
        utbmsExpenseCode:
          description: A UTBMS code for the disbursement.
          example: PH383
          type: string
        importExternalReference:
          description: Meta data property to hold an external reference. Typically used when importing data into Actionstep.
          example: U37303-73730
          type: string
        links:
          $ref: '#/components/schemas/CreateDisbursementLinks'

    CreateDisbursementLinks:
      type: object
      required:
        - action
      properties:
        action:
          description: Unique identifier of the matter to which the disbursement is associated.
          example: 64
          format: integer
          type: string
        enteredByParticipant:
          description: Unique identifier of the user who entered the disbursement.
          example: 964
          format: integer
          type: string
        uom:
          description: Unique identifier for the Unit of Measure used by the disbursement.
          example: 1748
          format: integer
          type: string
        taxCode:
          description: Unique identifier for the tax code applicable to the disbursement.
          example: 92
          format: integer
          type: string
        incomeAccount:
          description: Unique identifier for the income account applicable to this disbursement.
          example: 482
          format: integer
          type: string

    UpdateDisbursement:
      type: object
      properties:
        date:
          description: The date of the disbursement.
          example: 23-May-1987
          type: string
          format: date
        description:
          description: A description for the disbursement.
          example: Photocopying
          type: string
        quantity:
          description: The unit quantity for the disbursement.
          example: 1.0
          type: number
        unitPrice:
          description: The unit price for the disbursement.
          example: 24.50
          type: number
        unitPriceIncludesTax:
          description: Indicates if the unit price includes sales tax.
          enum:
            - T
            - F
          example: T
          type: string
        utbmsExpenseCode:
          description: A UTBMS code for the disbursement.
          example: PH383
          type: string
        importExternalReference:
          description: Meta data property to hold an external reference. Typically used when importing data into Actionstep.
          example: U37303-73730
          type: string
        links:
          $ref: '#/components/schemas/UpdateDisbursementLinks'

    UpdateDisbursementLinks:
      type: object
      properties:
        action:
          description: Unique identifier of the matter to which the disbursement is associated.
          example: 64
          format: integer
          type: string
        enteredByParticipant:
          description: Unique identifier of the user who entered the disbursement.
          example: 964
          format: integer
          type: string
        uom:
          description: Unique identifier for the Unit of Measure used by the disbursement.
          example: 1748
          format: integer
          type: string
        taxCode:
          description: Unique identifier for the tax code applicable to the disbursement.
          example: 92
          format: integer
          type: string
        incomeAccount:
          description: Unique identifier for the income account applicable to this disbursement.
          example: 482
          format: integer
          type: string

  requestBodies:
    CreateDisbursement:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateDisbursement'

    UpdateDisbursement:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UpdateDisbursement'
