Once when RDF representation of dynamic action and endpoints are defined, users can fire generating OpenAPI specification by executing the following HTTP Get request:

http://[servername:serverport/vivoappname]/docs/rest/[api version]/[resource name]

Response of this request is a YAML file in accordance with OpenAPI specification. This file might be published as part of documentation for newly developed action. Also, Swagger editor might be used to trying out the newly developed endpoints.

Here is an example of generated YAML record:

openapi: 3.0.1
info:
  title: API for VIVO
  description: This is an API for VIVO
  version: 1.0.0
tags:
- name: geolocation
  description: REST geolocation (1.0.0)
paths:
  /api/rest/1.0.0/geolocation:
    get:
      tags:
      - geolocation
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  geolocations:
                    type: array
                    description: List of available geolocations
                    items:
                      type: object
                      properties:
                        label:
                          type: string
                        uri:
                          type: string
                      description: List of available geolocations
        "401":
          description: Unauthorized
          content:
            text/plain:
              schema:
                type: string
        "403":
          description: Forbidden
          content:
            text/plain:
              schema:
                type: string
        "404":
          description: Resource not found
          content:
            text/plain:
              schema:
                type: string
    post:
      tags:
      - geolocation
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                label:
                  type: string
                uri:
                  type: string
      responses:
        "201":
          description: Created
        "401":
          description: Unauthorized
          content:
            text/plain:
              schema:
                type: string
        "403":
          description: Forbidden
          content:
            text/plain:
              schema:
                type: string
        "404":
          description: Resource not found
          content:
            text/plain:
              schema:
                type: string
  /api/rest/1.0.0/geolocation/resource:{resource_id}:
    get:
      tags:
      - geolocation
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  geolocations:
                    type: array
                    description: List of available geolocations
                    items:
                      type: object
                      properties:
                        label:
                          type: string
                        uri:
                          type: string
                      description: List of available geolocations
        "401":
          description: Unauthorized
          content:
            text/plain:
              schema:
                type: string
        "403":
          description: Forbidden
          content:
            text/plain:
              schema:
                type: string
        "404":
          description: Resource not found
          content:
            text/plain:
              schema:
                type: string
    parameters:
    - name: resource_id
      in: path
      description: Base64 encoded URI of the resource
      required: true
      schema:
        type: string

  • No labels