Ankorstore Media API

Operations for documents linked to fulfillment requests

OpenAPI Specification

ankorstore-media-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  version: 1.2.2-oas3.1
  title: Ankorstore Stock Tracking and Logistics Applications Media API
  summary: API specification for the Ankorstore Stock Tracking and Logistics system
  description: Ankorstore Stock Tracking and Logistics (ASTRAL) API specification
  contact:
    name: Ankorstore
    url: https://www.ankorstore.com
    email: api@ankorstore.com
  license:
    url: https://creativecommons.org/publicdomain/zero/1.0/
    name: CC0 1.0 Universal
servers:
- url: http://www.ankorlocal.com:8000
  description: Local Development Server
- url: https://www.preprod.ankorstore.com
  description: Staging Environment
- url: https://www.ankorstore.com
  description: Prod Environment
tags:
- name: Media
  description: Operations for documents linked to fulfillment requests
paths:
  /api/fulfillment/v1/media:
    delete:
      summary: Delete every media linked to a masterOrderUUID
      description: 'Delete one or more PDF documents linked to a fulfillment order (`masterOrderUuid`).

        '
      operationId: deleteMediaByMasterOrder
      parameters:
      - name: masterOrderUuid
        in: query
        required: true
        schema:
          type: string
          format: uuid
        description: UUID of the master order whose media will be deleted
      responses:
        '200':
          description: Media document successfully deleted
        '404':
          description: Master order not found
      tags:
      - Media
    get:
      summary: List media documents
      description: 'Retrieve all media documents linked to a fulfillment order (`masterOrderUuid`).

        '
      operationId: listMedia
      parameters:
      - in: query
        name: filter[masterOrderUuid]
        schema:
          type: string
          format: uuid
        required: true
        description: UUID of the master order to filter documents by.
      - in: query
        name: fields[media]
        schema:
          type: string
        required: false
        description: 'JSON:API sparse fieldsets parameter. When specified, only the requested fields are returned in the response. If omitted, default fields are returned (`masterOrderUuid`, `originalFilename`, `type`, `createdAt`).

          '
      responses:
        '200':
          description: Successfully retrieved media documents.
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/MediaList'
                  jsonapi:
                    $ref: '#/components/schemas/JsonApiObject'
        '400':
          description: Missing or invalid query parameter.
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    $ref: '#/components/schemas/ErrorList'
                  jsonapi:
                    $ref: '#/components/schemas/JsonApiObject'
        '500':
          description: Internal server error while fetching documents.
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    $ref: '#/components/schemas/ErrorList'
                  jsonapi:
                    $ref: '#/components/schemas/JsonApiObject'
      tags:
      - Media
  /api/fulfillment/v1/media/{mediaUuid}:
    delete:
      summary: Delete a specific media document
      description: Delete a specific document by its UUID
      operationId: deleteMediaByUuid
      parameters:
      - name: mediaUuid
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: UUID of the media document to delete
      responses:
        '200':
          description: Media document successfully deleted
        '404':
          description: Media document not found
      tags:
      - Media
  /api/fulfillment/v1/media/upload:
    post:
      summary: Upload PDF documents
      description: 'Upload one or more PDF documents linked to a fulfillment order (`masterOrderUuid`). Each document may include its own UUID, or the backend can generate one if not provided.

        '
      operationId: uploadMedia
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
              - masterOrderUuid
              - documents
              properties:
                masterOrderUuid:
                  type: string
                  format: uuid
                  description: UUID of the master order to which the documents will be linked.
                documents:
                  type: array
                  description: List of documents to upload.
                  items:
                    type: object
                    properties:
                      file:
                        type: string
                        format: binary
                        description: PDF file to upload.
                      uuid:
                        type: string
                        format: uuid
                        description: Optional UUID for the document. If omitted, the server generates one.
                      type:
                        type: string
                        enum:
                        - invoice
                        - attachment
                        default: attachment
                        description: Type of the document. Defaults to 'attachment' if not specified.
            encoding:
              documents:
                style: form
                explode: true
      responses:
        '201':
          description: Documents successfully uploaded.
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/MediaList'
                  jsonapi:
                    $ref: '#/components/schemas/JsonApiObject'
        '422':
          description: Validation error during upload.
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    $ref: '#/components/schemas/ErrorList'
                  jsonapi:
                    $ref: '#/components/schemas/JsonApiObject'
      tags:
      - Media
components:
  schemas:
    MediaList:
      type: array
      description: List of media resources.
      items:
        $ref: '#/components/schemas/Media'
    ErrorList:
      type: array
      description: List of errors.
      items:
        $ref: '#/components/schemas/Error'
    Error:
      type: object
      description: A single error item.
      properties:
        status:
          type: string
          example: '422'
          description: HTTP status code.
        code:
          type: string
          enum:
          - invalid_file_extension
          - file_too_large
          - max_files_reached
          - cannot_download_document
          description: "Error code:\n  * `invalid_file_extension`: at least one submitted file has an invalid extension.\n  * `file_too_large`: at least one file exceeds the maximum allowed size.\n  * `max_files_reached`: the maximum number of files for the master order has been reached.\n  * `cannot_download_document`: failed to download document from storage.\n"
        description:
          type: string
          description: Human-readable description of the error.
        meta:
          $ref: '#/components/schemas/ErrorMeta'
    Media:
      type: object
      description: Representation of a media resource.
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the uploaded document.
        type:
          type: string
          example: media
          description: Resource type (always `media`).
        attributes:
          $ref: '#/components/schemas/MediaAttributes'
    JsonApiObject:
      type: object
      description: JSON:API version information.
      properties:
        version:
          type: string
          example: '1.0'
          description: JSON:API specification version.
      additionalProperties: false
    ErrorMeta:
      type: object
      description: Additional metadata for an error.
      properties:
        filename:
          type: string
          description: Name of the file related to the error.
      additionalProperties: true
    MediaAttributes:
      type: object
      description: Attributes describing an uploaded document.
      properties:
        masterOrderUuid:
          type: string
          format: uuid
          description: UUID of the master order associated with the document.
        originalFilename:
          type: string
          description: Original file name.
        createdAt:
          type: string
          format: date-time
          description: Date and time when the document was created.
        type:
          type: string
          enum:
          - invoice
          - attachment
          default: attachment
          description: Type of the document. Defaults to 'attachment' if not specified.
        content:
          type: string
          description: 'Document content. Only present when explicitly requested.

            '
        encoding:
          type: string
          description: 'Encoding format used for the content field. Only present when explicitly requested.

            '
  securitySchemes:
    CookieKey:
      type: apiKey
      name: ankorstore_session
      in: cookie