openapi: 3.0.3

info:
  title: Action (Matter) Participants
  description: "For retrieving Matter participants. For historical reasons Matters are referred to as *actions* in this version of the API. The Action Participants resource represents participants for an Matter. 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:
  '/actionparticipants':
    get:
      description: Returns a collection of Matter participants. For information on how to construct requests filtering by various properties, please refer to the API Developer Portal.
      tags:
        - Action Participants
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedActionParticipants'

    post:
      description: Create a new Matter participant.
      tags:
        - Action Participants
      requestBody:
        $ref: '#/components/requestBodies/CreateActionParticipants'
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionParticipants'

  '/actionparticipants/{id}':
    get:
      description: Returns a single Matter participant.
      tags:
        - Action Participants
      parameters:
        - name: id
          in: path
          description: Unique identifier for a Matter Participant. The identifier is a composite value composed from the Matter identifier, the participant type identifier, and the participant identifier, separated by "--".
          required: true
          schema:
            type: string
          example: 1024--31--11
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionParticipants'

    delete:
      description: Removes a participant from a Matter.
      tags:
        - Action Participants
      parameters:
        - name: id
          in: path
          description: Unique identifier for an Matter participant. The identifier is a composite value composed from the Matter identifier, the participant type identifier, and the participant identifier, separated by "--".
          required: true
          schema:
            type: string
          example: 1024--31--11
      responses:
        '204':
          description: Success, No content.

components:
  schemas:
    PagedActionParticipants:
      type: object
      properties:
        actionparticipants:
          type: array
          items:
            $ref: '#/components/schemas/ActionParticipants'
        meta:
          $ref: '#/components/schemas/PageMetaData'

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

    PagingData:
      type: object
      properties:
        actionparticipants:
          $ref: '#/components/schemas/ActionParticipantsPageData'

    ActionParticipantsPageData:
      type: object
      properties:
        recordCount:
          description: The total number of Matter participants 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 Matter participants.
          type: integer
          example: 2
        pageSize:
          description: Page size.
          type: integer
          example: 50
        prevPage:
          description: A URL to the previous page of Matter participants.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/actionparticipants?page=1
        nextPage:
          description: A URL to the next page of Matter participants.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/actionparticipants?page=3

    ActionParticipants:
      type: object
      properties:
        id:
          description: Unique identifier for the Matter participant. The identifier is a composite value composed from the Matter identifier, the participant type identifier, and the participant identifier, separated by "--".
          example: 1024--31--11
          type: string
        participantNumber:
          description: The order the Matter participants were added to an action.
          example: 3
          type: integer
        links:
          $ref: '#/components/schemas/ActionParticipantsLinks'

    ActionParticipantsLinks:
      type: object
      properties:
        action:
          description: Unique identifier of the associated action.
          example: 1024
          type: integer
        participantType:
          description: Unique identifier of the participant type.
          example: 31
          type: integer
        participant:
          description: Unique identifier of the participant.
          example: 11
          type: integer

    CreateActionParticipants:
      type: object
      properties:
        actionparticipants:
          $ref: '#/components/schemas/CreateActionParticipantsLinks'

    CreateActionParticipantsLinks:
      type: object
      properties:
        links:
          $ref: '#/components/schemas/CreateActionParticipantsLinksLink'

    CreateActionParticipantsLinksLink:
      type: object
      properties:
        action:
          description: Unique identifier of the associated action.
          example: 1024
          type: integer
        participantType:
          description: Unique identifier of the participant type.
          example: 31
          type: integer
        participant:
          description: Unique identifier of the participant.
          example: 11
          type: integer

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