openapi: 3.0.3

info:
  title: Data Collection Record Values
  description: "For retrieving and managing data collection record values. A data collection record is a group of data fields acting as a single unit (record) of data. A data collection record value represents the actual value for a data field within a record. 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:
  '/datacollectionrecordvalues':
    get:
      description: Returns a collection of data collection record values.
      tags:
        - Data Collection Record Values
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedDataCollectionRecordValues'

    post:
      description: Create a new data collection record value.
      tags:
        - Data Collection Record Values
      requestBody:
        $ref: '#/components/requestBodies/CreateDataCollectionRecordValue'
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataCollectionRecordValue'

  '/datacollectionrecordvalues/{id}':
    get:
      description: Returns a single data collection record value.
      tags:
        - Data Collection Record Values
      parameters:
        - name: id
          in: path
          description: Unique identifier for a data collection record value.
          required: true
          schema:
            type: integer
            format: int32
          example: 380
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataCollectionRecordValue'
    put:
      description: Update a data collection record value.
      tags:
        - Data Collection Record Values
      parameters:
        - name: id
          in: path
          description: Unique identifier for a data collection record value.
          required: true
          schema:
            type: integer
            format: int32
          example: 608
      requestBody:
        $ref: '#/components/requestBodies/UpdateDataCollectionRecordValue'
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataCollectionRecordValue'

components:
  schemas:
    PagedDataCollectionRecordValues:
      type: object
      properties:
        datacollectionrecordvalues:
          type: array
          items:
            $ref: '#/components/schemas/DataCollectionRecordValue'
        meta:
          $ref: '#/components/schemas/PageMetaData'

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

    PagingData:
      type: object
      properties:
        datacollectionrecordvalues:
          $ref: '#/components/schemas/DataCollectionRecordValuesPageData'

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

    DataCollectionRecordValue:
      type: object
      properties:
        id:
          description: Unique identifier for the data collection record value. This is a composite identifier constructed from the data collection unique identifier, the data field name, and the data collection record unique identifier, all separated by a '--' delimiter.
          example: 148--victim_age--6234
          type: string
          format: string
          readOnly: true
        stringValue:
          description: Data field value as a string.
          example: 2023-12-25
          format: string
          type: string
        last_modified_time_stamp:
          description: Date and time the data field value was last modified.
          example: 2023-06-03T00:09:30+12:00
          format: timestamp
          type: string
        last_modified_by_user_id:
          description: Unique identifier for the Actionstep user who last modified the data field value.
          example: 7837
          type: integer
        links:
          $ref: '#/components/schemas/DataCollectionRecordValueLinks'

    DataCollectionRecordValueLinks:
      type: object
      properties:
        action:
          description: Unique identifier of the matter to which the data collection field value is associated.
          example: 500
          type: integer
        dataCollectionField:
          description: Unique identifier for the data collection field. This is a composite unique identifier composed from the data collection unique identifier and the data field name, separated by a '--' delimiter.
          example: 148--victim_age
          format: string
          type: string
        dataCollectionRecord:
          description: Unique identifier for the data record.
          example: 6234
          type: integer
        dataCollection:
          description: Unique identifier of the data collection to which the data collection record is associated.
          example: 148
          type: integer

    CreateDataCollectionRecordValue:
      type: object
      required:
        - stringValue
      properties:
        stringValue:
          description: Data field value as a string.
          example: 2023-12-25
          format: string
          type: string
        last_modified_time_stamp:
          description: Date and time the data field value is created.
          example: 2023-06-03T00:09:30+12:00
          format: timestamp
          type: string
        last_modified_by_user_id:
          description: Unique identifier for the Actionstep user who is creating the data field value.
          example: 7837
          type: integer
        links:
          $ref: '#/components/schemas/CreateDataCollectionRecordValueLinks'

    CreateDataCollectionRecordValueLinks:
      type: object
      required:
        - action
        - dataCollectionField
        - dataCollectionRecord
        - dataCollection
      properties:
        action:
          description: Unique identifier of the matter to which the data collection field value is associated.
          example: 500
          type: integer
        dataCollectionField:
          description: Unique identifier for the data collection field. This is a composite unique identifier composed from the data collection unique identifier and the data field name, separated by a '--' delimiter.
          example: 148--victim_age
          format: string
          type: string
        dataCollectionRecord:
          description: Unique identifier for the data collection record.
          example: 6234
          type: integer
        dataCollection:
          description: Unique identifier of the data collection to which the data collection record is associated.
          example: 148
          type: integer

    UpdateDataCollectionRecordValue:
      type: object
      required:
        - stringValue
      properties:
        stringValue:
          description: Data field value as a string.
          example: 2023-12-25
          format: string
          type: string
        last_modified_time_stamp:
          description: Date and time the data field value is modified.
          example: 2023-06-03T00:09:30+12:00
          format: timestamp
          type: string
        last_modified_by_user_id:
          description: Unique identifier for the Actionstep user who is modifying the data field value.
          example: 7837
          type: integer
        links:
          $ref: '#/components/schemas/UpdateDataCollectionRecordValueLinks'

    UpdateDataCollectionRecordValueLinks:
      type: object
      properties:
        action:
          description: Unique identifier of the matter to which the data collection field value is associated.
          example: 500
          type: integer
        dataCollectionField:
          description: Unique identifier for the data collection field. This is a composite unique identifier composed from the data collection unique identifier and the data field name, separated by a '--' delimiter.
          example: 148--victim_age
          format: string
          type: string
        dataCollectionRecord:
          description: Unique identifier for the data record.
          example: 6234
          type: integer
        dataCollection:
          description: Unique identifier of the data collection to which the data collection record is associated.
          example: 148
          type: integer

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

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