The Ping-Pong API is used to test client APIs running in Rhino.

A test suite initiates a test scenario by sending Rhino a Ping REST request, with a request body that identifies the client API, and associated test scenario, the Rhino test service should trigger.

This user guide will use the Ping Pong API as an illustrative example while explaining how to create a REST API and REST resource adaptor with the Rhino REST API Framework.

pingpong api.drawio
Using the Ping Pong API

Ping Pong API specification

Preamble

Preamble
openapi: "3.0.0"
info:
  version: 1.0.0
  title: Ping Pong API
  description: |
    The Ping Pong API is used to test client APIs running in Rhino.
    The test suite initiates a test scenario by sending Rhino a Ping REST request,
    with a request body that identifies the client API and associated test scenario
    the Rhino test service should trigger.
  license:
    name: Proprietary
    url: 'https://www.metaswitch.com'
servers:
  - url: /pingpong

Ping request

A GET request with request URL path /pingpong/ping. Request body is a JSon object defined by #/components/schemas/PingContext

Ping request
  /ping:
    post:
      operationId: ping
      tags:
        - ping
      requestBody:
        description: a test scenario to triger for an api
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PingContext'

Ping responses

Defines the set of possible responses. 200 Success response, with a String response body.

The default corresponds to any other response. The response body is a JSon object defined by #/components/schemas/Error.

Ping responses
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
                example: OK
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

Ping context

The Ping request body is a JSon object with two required fields:

  • api — a String that identifies the API to test

  • scenario — a String that identifies the test scenario to trigger

Ping context
components:
  schemas:

    PingContext:
      type: object
      required:
        - api
        - scenario
      properties:
        api:
          type: string
        scenario:
          type: string
Previous page Next page