:::open-api-operation
---
operation:
  kind: operation
  method: put
  path: /vessels/{imo}/manifest
  operationId: replaceManifest
  summary: Replace a vessel's manifest
  deprecated: false
  tags:
    - Vessels
  parameters:
    - name: imo
      in: path
      description: The vessel's IMO number.
      required: true
      schema:
        types:
          - string
        constraints:
          pattern: ^IMO[0-9]{7}$
    - name: If-Match
      in: header
      description: The manifest revision you are replacing.
      required: false
      schema:
        types:
          - string
  requestBody:
    required: true
    content:
      - type: application/json
        schema:
          types:
            - object
          properties:
            - name: entries
              required: true
              schema:
                types:
                  - array
                items:
                  name: ManifestEntry
                  ref: "#/components/schemas/ManifestEntry"
                  types:
                    - object
                  properties:
                    - name: line
                      required: true
                      schema:
                        types:
                          - integer
                        constraints:
                          minimum: 1
                    - name: contents
                      required: true
                      schema:
                        anyOf:
                          - types:
                              - object
                            properties:
                              - name: consignmentId
                                required: false
                                schema:
                                  types:
                                    - string
                                  format: uuid
                          - types:
                              - object
                            properties:
                              - name: description
                                required: false
                                schema:
                                  types:
                                    - string
                              - name: weightKg
                                required: false
                                schema:
                                  types:
                                    - number
                                  constraints:
                                    minimum: 0
  responses:
    - status: "200"
      description: The manifest as it now stands.
      content:
        - type: application/json
          schema:
            types:
              - array
            items:
              name: ManifestEntry
              ref: "#/components/schemas/ManifestEntry"
              types:
                - object
              properties:
                - name: line
                  required: true
                  schema:
                    types:
                      - integer
                    constraints:
                      minimum: 1
                - name: contents
                  required: true
                  schema:
                    anyOf:
                      - types:
                          - object
                        properties:
                          - name: consignmentId
                            required: false
                            schema:
                              types:
                                - string
                              format: uuid
                      - types:
                          - object
                        properties:
                          - name: description
                            required: false
                            schema:
                              types:
                                - string
                          - name: weightKg
                            required: false
                            schema:
                              types:
                                - number
                              constraints:
                                minimum: 0
    - status: "412"
      description: Something went wrong, described the same way every time.
      content:
        - type: application/problem+json
          schema:
            name: Problem
            ref: "#/components/schemas/Problem"
            types:
              - object
            properties:
              - name: title
                required: true
                schema:
                  types:
                    - string
                  description: A short, human-readable summary.
              - name: status
                required: true
                schema:
                  types:
                    - integer
                  constraints:
                    minimum: 400
                    maximum: 599
              - name: detail
                required: false
                schema:
                  types:
                    - string
                    - "null"
servers:
  - url: https://api.example.org/{stage}
    description: The invented production host.
    variables:
      - name: stage
        default: v3
        enum:
          - v1
          - v2
          - v3
        description: Which line of the API to talk to.
  - url: http://localhost:8080
    description: A local process, for trying things out.
security:
  - - key: apiKey
      scheme:
        key: apiKey
        type: apiKey
        description: A key from the account page.
        name: X-Api-Key
        in: header
  - - key: bearer
      scheme:
        key: bearer
        type: http
        description: A token obtained from the authorisation server.
        scheme: bearer
        example: demo-token
        bearerFormat: JWT
securitySchemes:
  - key: apiKey
    type: apiKey
    description: A key from the account page.
    name: X-Api-Key
    in: header
  - key: bearer
    type: http
    description: A token obtained from the authorisation server.
    scheme: bearer
    example: demo-token
    bearerFormat: JWT
  - key: oauth
    type: oauth2
    description: For applications acting on someone else's behalf.
    flows:
      - name: authorizationCode
        authorizationUrl: https://auth.example.org/authorize
        tokenUrl: https://auth.example.org/token
        scopes:
          - name: consignments:read
            description: Read consignments
          - name: consignments:write
            description: Book and change consignments
---
The whole manifest at once — a `PUT`, because half a manifest is not a
smaller manifest, it is a wrong one.
:::