Sunday, October 4, 2020

OAS in SAP API Management

 Steps:

  1. Go to API portal -> Develop -> Create in API Designer
  2. Write OAS 3.0 specification and you will be able to see related documentation. The Google Book API is used for example purpose. You can use any available public API to test.

openapi: 3.0.1
info:
  title: Google Book API
  description: This is a sample API for calling Google Book API
  version: 1.0.0
servers:
  - url: 'https://www.googleapis.com/books/v1'
paths:
  /volumes:
    get:
      operationId: getBooks
      # CommonMark is used to change the description to italic
      description: _Get a list of Books_
      parameters:
        - name: q
          in: query
          description: Enter query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: successful response

 3. Now we can tryout the documentation.



4. Now we can save the spec. Now if you open the spec, you will see, the original URL is under info/x-targetEndpoint and x-servers/url and the generated proxy url is under servers/url. You can change the proxy endpoint also, which got generated automatically.

5. Now if you click on TryOut and exceute, you will get 404 error as the API is not deployed yet. Now deploy the API and then click on TryOut. It should work now.  


No comments:

Post a Comment