Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Once you add a Swagger asset, which is associated with a lively available REST service to WSO2 Governance Registry, you can invoke it using the in-built Swagger UI in WSO2 G-Reg by copying its URL to Clipboard as explained below.

Adding the Swagger file

Follow the steps below to add the underlying Swagger file of then sample publicly available live REST Service that we use in this guide, to WSO2 G-Reg. For more information on adding a REST Service to WSO2 G-Reg, see Adding a REST Service.

  1. Log in to the G-Reg Publisher using the following URL and admin/admin credentials: https://<G-REG_HOST>:<G-REG_PORT>/publisher
  2. Click the main menu button of the G-Reg Publisher, and then click Swaggers as shown below.
    select Swaggers from the main menu
  3. Click the following ADD button: 
  4. Select Upload Swagger from a file as shown below.
    select the option to upload a file
  5. Click Browse to select the Swagger file to upload it, and then specify its version as shown below. 
    enter details of the Swagger file
  6. Click Create.
  7. Refresh the screen to view the new Swagger artifact you added as shown below.

  8. added Swagger asset

Viewing the dependencies of the added Swagger

Follow the steps below to view how the added REST Service, Swagger, and Endpoint are created and linked together using the provided dependency view. For more information on viewing dependencies between assets, see Viewing Dependencies of Artifacts.

  1. Click the Swagger artifact which you created above.
  2. Click the following Show Dependency button:Show Dependency button
    You view the dependencies of the selected artifact as shown below.
    view dependencies

Invoking the Service using the in-built Swagger UI

Follow the steps below to invoke the added service using the in-built Swagger UI.

  1. Click the following Go to Store button in the top right hand corner of the G-Reg Publisher Home Page, to access the G-Rg Store: 
    Go To Store button
  2. Log in to the G-Reg Store using the following URL and admin/admin credentials: https://<G-REG_HOST>:<G-REG_PORT>/store
  3. Click Swaggers in the main menu as shown below.
  4. Click the Swagger which you added as shown below.
  5. Click the following Swagger UI button, to invoke the Service using the in-built Swagger UI: 
    Swagger UI button
  6. Click the pet link in the Swagger UI, and then click on the GET /pet/{petId} box to expand it as shown below.
  7. Enter a value for petId, and click the Try it out! button as shown below, to make an invocation.
  8. Click the icon next to the address bar of your browser, and then click Load unsafe scripts (if you are using Google Chrome) as shown below.

    This step is required to enable scripts from unauthenticated sources since by default they are blocked in Web browsers as a standard. Hence, if your page supports http, it will not allow to load content which uses the https protocol and vice versa. You will view different message pop-ups depending on the Web browser you use. For more information on this, see Chrome and Firefox: Blocked Mixed (HTTPS and HTTP) Content.

    load unsafe scripts by Web browser

  9. Repeat steps 6 and 7 above. You view the response of the Service invocation as shown below.
    invocation response
  • No labels