Skip to content
openapi.yaml 19 KiB
Newer Older
Nathan Chambron's avatar
Nathan Chambron committed
openapi: "3.0.0"
#
# API for the Augmented Reality Framework (ARF)
# Working group: ETSI ISG ARF
# STF group: STF620 (validation)
# (C) ETSI - 2022
#
# References:
# - Explaination UUID: https://en.wikipedia.org/wiki/Universally_unique_identifier / https://fr.wikipedia.org/wiki/Universally_unique_identifier
# - UUID formats: 8-4-4-4-12 format string, lower case (but case insensitive on input) 
# - UUID RFC4122: https://datatracker.ietf.org/doc/html/rfc4122#section-3
# - Rules for RESTful error code RFC2616: https://datatracker.ietf.org/doc/html/rfc2616#section-10
# - Guide: https://restfulapi.net/http-status-codes/
#
# Last Version: 04.03.2022
#
Nathan Chambron's avatar
Nathan Chambron committed
info: 
Nathan Chambron's avatar
Nathan Chambron committed
  title: World Storage API
  description: API ensuring interoperability between an authoring tool and a World Storage service
  license:
    name: BSD-3-clause
    url: https://opensource.org/licenses/BSD-3-Clause
servers:
  - url: http://localhost:8080
paths:
  /ping:
    get:
      summary: Test the server availability
      operationId: getPing
Nathan Chambron's avatar
Nathan Chambron committed
      responses:
        '200':
          description: OK, world storage alive.
Nathan Chambron's avatar
Nathan Chambron committed
  /admin:
    get:
      summary: Get the version of the API.
Nathan Chambron's avatar
Nathan Chambron committed
      operationId: getVersion
      responses:
        '200':
          description: OK, world storage ready.
Nathan Chambron's avatar
Nathan Chambron committed
          content:
            text/plain:
              schema: 
                type: string      

##############
# TRACKABLES #
##############
Nathan Chambron's avatar
Nathan Chambron committed
  /trackables:
    post:
      summary: Create a trackable.
Nathan Chambron's avatar
Nathan Chambron committed
      operationId: addTrackable
      tags:
        - trackables
      requestBody:
          description: The trackable to be added to the world storage.
Nathan Chambron's avatar
Nathan Chambron committed
          required: true
          content:
            application/json:
              schema:
Eric Villain's avatar
Eric Villain committed
                $ref: '#/components/schemas/Trackable'
            #application/xml:
            #  schema:
            #    $ref: '#/components/schemas/Trackable'
Nathan Chambron's avatar
Nathan Chambron committed
      responses:
        '200':
          description: OK, returns the UUID of the Trackable defined by the world storage.
Nathan Chambron's avatar
Nathan Chambron committed
          content:
            text/plain:
              schema: 
                type: string            
        '201':
          description: Null response.
        '400':
          $ref: '#/components/responses/400_BadRequest'
        '409': 
          $ref: '#/components/responses/409_NotEmptyUUID'
        'default':
          $ref: '#/components/responses/4xx_UnexpectedError'
Nathan Chambron's avatar
Nathan Chambron committed
    get:
      summary: Returns the list of all trackables defined by the world storage.
Nathan Chambron's avatar
Nathan Chambron committed
      operationId: getTrackables
      tags:
        - trackables
      responses:
          description: OK, returns all the Trackables defined by the world storage.
Nathan Chambron's avatar
Nathan Chambron committed
          content:
            application/json:
              schema:
                type : array
                items :
Eric Villain's avatar
Eric Villain committed
                  $ref: "#/components/schemas/Trackable"          
          description: Null response.
Nathan Chambron's avatar
Nathan Chambron committed
        default:
          $ref: '#/components/responses/4xx_UnexpectedError'

  /trackables/{trackableUUID}:
Nathan Chambron's avatar
Nathan Chambron committed
    get:
      summary: Find a trackable by its UUID.
Nathan Chambron's avatar
Nathan Chambron committed
      operationId: getTrackableById
      tags:
      - trackables
      parameters:
        - name: trackableUUID
Nathan Chambron's avatar
Nathan Chambron committed
          in: path
          description: UUID of the trackable to retrieve.
Nathan Chambron's avatar
Nathan Chambron committed
          required: true
          schema:
            type: string
            format: uuid
Nathan Chambron's avatar
Nathan Chambron committed
      responses:
        '200':
          description: Successful operation.
Nathan Chambron's avatar
Nathan Chambron committed
          content:
            application/json:
              schema:
Eric Villain's avatar
Eric Villain committed
                $ref: '#/components/schemas/Trackable' 
Nathan Chambron's avatar
Nathan Chambron committed
        '400':
          $ref: '#/components/responses/400_InvalidUUID'
Nathan Chambron's avatar
Nathan Chambron committed
        '404':
          $ref: '#/components/responses/404_NotFoundUUID'
      summary: Deletes a trackable.
      operationId: deleteTrackable
      tags:
      - trackables
      parameters:
        - name: trackableUUID
          description: Trackable UUID to delete.
          required: true
          schema:
            type: string
            format: uuid
          description: OK, delete successful.
          $ref: '#/components/responses/400_InvalidUUID'
          $ref: '#/components/responses/404_NotFoundUUID'   

#################
# WORLD ANCHORS #
#################
Eric Villain's avatar
Eric Villain committed
  /worldAnchors:
    post:
      summary: Create a world anchor.
Eric Villain's avatar
Eric Villain committed
      operationId: addWorldAnchor
      tags:
        - world anchors
      requestBody:
          description: The world anchor to be added to the world storage.
Eric Villain's avatar
Eric Villain committed
          required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorldAnchor'             
            #application/xml:
            #  schema:
            #    $ref: '#/components/schemas/WorldAnchor'
Eric Villain's avatar
Eric Villain committed
      responses:
        '200':
          description: OK, returns the UUID of the World Anchor defined by the world storage.
Eric Villain's avatar
Eric Villain committed
          content:
            text/plain:
              schema: 
                type: string            
        '201':
          description: Null response.
        '400':
          $ref: '#/components/responses/400_BadRequest'
        '409': 
          $ref: '#/components/responses/409_NotEmptyUUID'
        'default':
          $ref: '#/components/responses/4xx_UnexpectedError'
Eric Villain's avatar
Eric Villain committed
    get:
      summary: Returns the list of all world anchors defined by the world storage.
Eric Villain's avatar
Eric Villain committed
      operationId: getWorldAnchors
      tags:
        - world anchors
      responses:
        '200':
          description: OK, returns all the world anchors defined by the world storage.
Eric Villain's avatar
Eric Villain committed
          content:
            application/json:
              schema:
                type : array
                items :
                  $ref: "#/components/schemas/WorldAnchor"          
        '201':
          description: Null response.
Eric Villain's avatar
Eric Villain committed
        default:
          $ref: '#/components/responses/4xx_UnexpectedError'

  /worldAnchors/{worldAnchorUUID}:
Eric Villain's avatar
Eric Villain committed
    get:
      summary: Find a world anchor by its UUID.
Eric Villain's avatar
Eric Villain committed
      operationId: getWorldAnchorById
      tags:
      - world anchors
      parameters:
        - name: worldAnchorUUID
Eric Villain's avatar
Eric Villain committed
          in: path
          description: UUID of the world anchor to retrieve.
Eric Villain's avatar
Eric Villain committed
          required: true
          schema:
            type: string
            format: uuid
Eric Villain's avatar
Eric Villain committed
      responses:
        '200':
          description: Successful operation.
Eric Villain's avatar
Eric Villain committed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorldAnchor' 
        '400':
          $ref: '#/components/responses/400_InvalidUUID'
Eric Villain's avatar
Eric Villain committed
        '404':
          $ref: '#/components/responses/404_NotFoundUUID'
Eric Villain's avatar
Eric Villain committed
    delete:
      summary: Deletes a world anchor.
Eric Villain's avatar
Eric Villain committed
      operationId: deleteWorldAnchor
      tags:
      - world anchors
      parameters:
        - name: worldAnchorUUID
Eric Villain's avatar
Eric Villain committed
          in: path
          description: World anchor UUID to delete.
Eric Villain's avatar
Eric Villain committed
          required: true
          schema:
            type: string
            format: uuid
Eric Villain's avatar
Eric Villain committed
      responses:
        '200':
          description: OK, delete successful.
Eric Villain's avatar
Eric Villain committed
        '400':
          $ref: '#/components/responses/400_InvalidUUID'
Eric Villain's avatar
Eric Villain committed
        '404':
          $ref: '#/components/responses/404_NotFoundUUID'   

###############
# WORLD LINKS #
###############
Eric Villain's avatar
Eric Villain committed
  /worldLinks:
    post:
      summary: Create a link between world anchors and trackables.
Eric Villain's avatar
Eric Villain committed
      operationId: addWorldLink
      tags:
        - world links
      requestBody:
          description: The link to be added to the world storage.
Eric Villain's avatar
Eric Villain committed
          required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorldLink'
            #application/xml:
            #  schema:
            #    $ref: '#/components/schemas/WorldLink'
Eric Villain's avatar
Eric Villain committed
      responses:
        '200':
          description: OK, returns the UUID of the link defined by the world storage.
Eric Villain's avatar
Eric Villain committed
          content:
            text/plain:
              schema: 
                type: string            
        '201':
          description: Null response
        '400':
          $ref: '#/components/responses/400_BadRequest'
        '409': 
          $ref: '#/components/responses/409_NotEmptyUUID'
        'default':
          $ref: '#/components/responses/4xx_UnexpectedError'
Eric Villain's avatar
Eric Villain committed
    get:
      summary: Returns the list of all links defined by the world storage.
Eric Villain's avatar
Eric Villain committed
      operationId: getWorldLinks
      tags:
        - world links
      responses:
        '200':
Eric Villain's avatar
Eric Villain committed
          description: OK returns all the worldLinks defined by the world storage.
          content:
            application/json:
              schema:
                type : array
                items :
                  $ref: "#/components/schemas/WorldLink"          
        '201':
Eric Villain's avatar
Eric Villain committed
          description: Null response
        default:
         $ref: '#/components/responses/4xx_UnexpectedError'

  /worldLinks/{worldLinkUUID}:
Eric Villain's avatar
Eric Villain committed
    get:
      summary: Find a link by its UUID.
Eric Villain's avatar
Eric Villain committed
      operationId: getWorldLinkById
      tags:
      - world links
      parameters:
        - name: worldLinkUUID
Eric Villain's avatar
Eric Villain committed
          in: path
          description: UUID of the link to retrieve.
Eric Villain's avatar
Eric Villain committed
          required: true
          schema:
            type: string
            format: uuid
Eric Villain's avatar
Eric Villain committed
      responses:
        '200':
          description: Successful operation.
Eric Villain's avatar
Eric Villain committed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorldLink' 
        '400':
          $ref: '#/components/responses/400_InvalidUUID'
Eric Villain's avatar
Eric Villain committed
        '404':
          $ref: '#/components/responses/404_NotFoundUUID'
Eric Villain's avatar
Eric Villain committed
    delete:
      summary: Deletes a worldLink.
Eric Villain's avatar
Eric Villain committed
      operationId: deleteWorldLink
      tags:
      - world links
      parameters:
        - name: worldLinkUUID
Eric Villain's avatar
Eric Villain committed
          in: path
          description: link id to delete
          required: true
          schema:
            type: string
            format: uuid
Eric Villain's avatar
Eric Villain committed
      responses:
        '200':
          description: OK
        '400':
          $ref: '#/components/responses/400_InvalidUUID'
        '404':
         $ref: '#/components/responses/404_NotFoundUUID'
 
  /worldLinks/attached/{worldLinkUUID}:
    get:
      summary: Retrieve end objects connected to this world link by its UUID.
      operationId: getAttachedObjectsFromUUID
      tags:
      - world links
      parameters:
        - name: worldLinkUUID
          in: path
          description: UUID of the link from which you will retrieve the end objects.
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttachedObjects' 
        '400':
          $ref: '#/components/responses/400_InvalidUUID'
Eric Villain's avatar
Eric Villain committed
        '404':
          $ref: '#/components/responses/404_NotFoundUUID'

# COMPONENTS ###############################################
Nathan Chambron's avatar
Nathan Chambron committed
components:
  #-------------------------------
  # Reusable operation parameters
  #-------------------------------
  parameters:
    UUIDParams:
      name: UUID
      in: path
      required: true
      description: A Universally Unique IDentifier identifying the object
      schema:
        type: string
        format: uuid
        default: "00000000-0000-0000-0000-000000000000"

  #-------------------------------
  # Reusable schemas (data models)
  #-------------------------------
Nathan Chambron's avatar
Nathan Chambron committed
  schemas:
Eric Villain's avatar
Eric Villain committed
    Trackable:
Nathan Chambron's avatar
Nathan Chambron committed
      type: object
      required:
Nathan Chambron's avatar
Nathan Chambron committed
        - trackableType
        - trackableEncodingInformation
        - trackablePayload
Eric Villain's avatar
Eric Villain committed
        - unit
Nathan Chambron's avatar
Nathan Chambron committed
        - keyvalueTagList
      properties:
          description: A Universally Unique IDentifier identifying the trackable (RFC 4122).
          type: string
          format: uuid
          example: fa8bbe40-8052-11ec-a8a3-0242ac120002
          description: A Universally Unique IDentifier identifying the creator of the trackable (a person, a team or a company).
Nathan Chambron's avatar
Nathan Chambron committed
          type: string
          format: uuid
          example: c75f6324-77a0-11ec-90d6-0242ac120003
        trackableType:
          description: Extensible list of trackable types possibly handled by complient World Storage implementation.
Nathan Chambron's avatar
Nathan Chambron committed
          type: string
          enum: [FIDUCIAL_MARKER, IMAGE_MARKER, MAP, OTHER]
          example: FIDUCIAL_MARKER
        trackableEncodingInformation:         
Eric Villain's avatar
Eric Villain committed
          $ref: '#/components/schemas/EncodingInformationStructure'
Nathan Chambron's avatar
Nathan Chambron committed
        trackablePayload:
          description: The data provided to create the trackable in a specific format handled by the World Storage service.
          type: string
          format: byte
          example: "10110101"
        localCRS:
            $ref: '#/components/schemas/Transform3D'
Eric Villain's avatar
Eric Villain committed
        unit:
            $ref: '#/components/schemas/UnitSystem'
        trackableSize:
            $ref: '#/components/schemas/Size'
Eric Villain's avatar
Eric Villain committed
        keyvalueTags:
            $ref: '#/components/schemas/KeyvalueTagList'
    WorldAnchor:
Eric Villain's avatar
Eric Villain committed
      type: object
      required:
Eric Villain's avatar
Eric Villain committed
        - localCRS
        - unit
        - worldAnchorSize
Eric Villain's avatar
Eric Villain committed
        - keyvalueTagList
      properties:
          description: A Universally Unique IDentifier identifying the world anchor (RFC 4122).
Eric Villain's avatar
Eric Villain committed
          type: string
          format: uuid
          example: ce8ccd80-56ee-2a5c-a8a3-0242ac150d002
          description: A Universally Unique IDentifier identifying the creator of the world anchor.
Eric Villain's avatar
Eric Villain committed
          type: string
          format: uuid
          example: c75f6324-77a0-11ec-90d6-0242ac120003
        localCRS:
            $ref: '#/components/schemas/Transform3D'
Eric Villain's avatar
Eric Villain committed
        unit:
            $ref: '#/components/schemas/UnitSystem'
        worldAnchorSize:
            $ref: '#/components/schemas/Size'
Eric Villain's avatar
Eric Villain committed
        keyvalueTags:
            $ref: '#/components/schemas/KeyvalueTagList'
Eric Villain's avatar
Eric Villain committed
    WorldLink:
      type: object
      required:
        - creatorUUID
        - UUIDFrom
        - UUIDTo
        - transform
Eric Villain's avatar
Eric Villain committed
        - unit
Eric Villain's avatar
Eric Villain committed
        - keyvalueTags
      properties:
          description: A Universally Unique IDentifier identifying the link (RFC 4122).
Eric Villain's avatar
Eric Villain committed
          type: string
          format: uuid
          example: ce8ccd80-56ee-2a5c-a8a3-0242ac150d002
          description: A Universally Unique IDentifier identifying the creator of the link.
Eric Villain's avatar
Eric Villain committed
          type: string
          format: uuid
          example: c75f6324-77a0-11ec-90d6-0242ac120003
          description: A Universally Unique IDentifier identifying a world anchor or trackable.
Eric Villain's avatar
Eric Villain committed
          type: string
          format: uuid
          example: ce8ccd80-56ee-2a5c-a8a3-0242ac150d002
          description: A Universally Unique IDentifier identifying a world anchor or trackable.
Eric Villain's avatar
Eric Villain committed
          type: string
          format: uuid
          example: ce8ccd80-56ee-2a5c-a8a3-0242ac150d002    
        transform:
            $ref: '#/components/schemas/Transform3D'
Eric Villain's avatar
Eric Villain committed
        unit:
            $ref: '#/components/schemas/UnitSystem'
        linkSize:
            $ref: '#/components/schemas/Size'
Eric Villain's avatar
Eric Villain committed
        keyvalueTags:
            description: List of additional parameters to be stored
            $ref: '#/components/schemas/KeyvalueTagList'
            example: { "LinkType" : ["Hierarchy"]}    

    AttachedObjects:
      type: object
      required:
        - UUID        
        - UUIDFrom
        - UUIDTo
        - TypeFrom
        - TypeTo
      properties:
        UUID:
          description: A Universally Unique IDentifier identifying the link.
          type: string
          format: uuid
          example: ce8ccd80-56ee-2a5c-a8a3-0242ac150d002
        UUIDFrom:
          description: A Universally Unique IDentifier identifying a world anchor or trackable.
          type: string
          format: uuid
          example: ce8ccd80-56ee-2a5c-a8a3-0242ac150d002
        UUIDTo:
          description: A Universally Unique IDentifier identifying a world anchor or trackable.
          type: string
          format: uuid
          example: ce8ccd80-56ee-2a5c-a8a3-0242ac150d002   
        TypeFrom:
          $ref: '#/components/schemas/ObjectType'
        TypeTo:
          $ref: '#/components/schemas/ObjectType'

Eric Villain's avatar
Eric Villain committed
    EncodingInformationStructure:
Nathan Chambron's avatar
Nathan Chambron committed
      required:
        - dataFormat
        - version
      properties:
        dataFormat:
          description: Identifier of the target framework
          type: string
          enum: [HOLOLENS, ARKIT, ARCORE]
          example : "HOLOLENS"
        version:
          description: The version of the format
          type: string
          example : "1.01"
Eric Villain's avatar
Eric Villain committed
        description: Coordinate reference system of the world anchor, a 4*4 matrix (rowmajor) represented by a float vector
        type: array
        minItems: 16
        maxItems: 16
        items:
            type: number
            format: float
        example: [-2, 1,-3, 4,
                   4, 4, 4, 2,
                   1, 0,-2, 1,
                  -1,-2, 0, 0]

    ObjectType:
        description: Type of an world representaion object.
        type: string
        enum: [Trackable, WorldAnchor, WorldLink]
        example: Trackable

Eric Villain's avatar
Eric Villain committed
    UnitSystem:
        description: Unit of length.
Eric Villain's avatar
Eric Villain committed
        type: string
        enum: [MM,  CM,  DM,  M,  DAM,  HM,  KM,  INCH, FOOT, YARD, MILE]
        description: Size {width, length, depth}.
Eric Villain's avatar
Eric Villain committed
        type: array
        items:
            type: number
            format: double
        minItems: 3
        maxItems: 3
        example: [1,5,0]   

Eric Villain's avatar
Eric Villain committed
    KeyvalueTagList:   
        description: List of additional parameters to be stored with the trackable.
        type: object
        additionalProperties:
            type: array
            items:
                type: string
            minItems: 1
        example: { "Place" : ["Museum 1"], "room" : ["B4"]} 
Nathan Chambron's avatar
Nathan Chambron committed
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
Eric Villain's avatar
Eric Villain committed
          type: string
  #-------------------------------
  # Reusable responses
  #-------------------------------
  responses:
    #######################
    # 1xx : Informational #
    #######################

    #################
    # 2xx : Success #
    #################

    #####################
    # 3xx : Redirection #
    #####################

    #######################
    # 4xx : Client Errors #
    #######################
    400_BadRequest:
      description: Bad request.

    400_InvalidUUID:
      description: Invalid UUID supplied.

    404_NotFoundUUID:
      description: Not found, could not find UUID in database.

    409_NotEmptyUUID:
      description: Invalid UUID, id must be a Nil value.

    4xx_UnexpectedError:      # Can be referenced as '#/components/responses/GenericError'
      description: Unexpected error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'

    ########################
    # 5xx : Server Errors  #
    ########################
    5xx_UnexpectedError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'