Testing your work

At a point, you can test the work that you have done so far. To do so, you need to open Swagger UI tool by navigating to the follow URL in a browser window:
  • host:8180/pc/resources/swagger-ui

Replace host with the actual server name. For example, replace host with localhost if running the PolicyCenter application server on your local machine.

Working with Swagger UI

After you open Swagger UI, you can perform the following types of tasks:
  • Set the user name and password credentials in the Authorize dialog.
  • See the list of published APIs available on this host.
  • See the Swagger schema for the currently viewed API.
To view the list of published APIs, click the first GET / link in the list. You then need to click Try it out and then Execute. If successful, Swagger UI returns a list of published APIs available on the application server. The list looks similar to the following example. Notice that the docs element lists the URL for each published API.
{
  "/apis": {
    "basePath": "/apis",
    "description": "Dynamically lists the APIs that are available",
    "docs": "http://localhost:8180/pc/rest/apis/swagger.json",
    "title": "API List"
  },
  "/example/v1": {
    "basePath": "/mc/activityapi",
    "description": "APIs for manipulating activities",
    "docs": "http://localhost:8180/pc/rest/mc/activityapi/swagger.json",
    "title": "Activities API"
  },
  "/system/v1/server": {
    "basePath": "/system/v1/server",
    "description": "This API is related to system server resources.\n",
    "docs": "http://localhost:8180/pc/rest/system/v1/server/swagger.json",
    "title": "System tools server API"
  }
}

Viewing and testing the Activities API

Copy the docs URL for the Activities API and paste it into the Explore field. After you click Explore, Swagger UI generates the HTTP operations for the Activities API. Use Swagger UI functionality to test each API endpoint and operation defined in the Swagger schema.

At this point, there is no backing functionality for the API operations. However, do not continue defining the Activities API if Swagger UI or the API operations generate any kind of error message. Fix any errors with your defined configuration files before continuing the API development process.