File published-apis.yaml

Merely creating the API schema files does not, by itself, create a network endpoint. To create an API endpoint, you must explicitly publish any APIs that you create by listing each API in file published-apis.yaml, located in Studio in the following directory:
  • configuration > config > Integration > apis > ...
Guidewire requires that you publish REST APIs explicitly in file published-apis.yaml for the following reasons:
  1. It gives you total control over the network exposure of Guidewire PolicyCenter. The REST API framework does not publish an API merely because the API is part of the base PolicyCenter application.
  2. It ensures that if you extend the Guidewire base API Swagger files, you can publish the resulting APIs using your own namespace and versioning schema.
  3. It ensure that you do not accidentally publish an API. Thus, it ensures that test, or development, APIs do not accidentally leak into a production network.
File published-apis.yaml has the following form.
apis:
  - name: gw.pl.framework.api_list-1.0
  - name: fully.qualified.path.to.apifile

defaultTemplate:
  - name: gw.core.pc.framework.v1.dev_template-1.0
  - name: fully.qualified.path.to.templatefile

API templates

It is possible for the server environment to affect some aspects of how the REST framework exposes an API to the network. A primary use case is the security section of the Swagger documents. If a server allows for HTTP Basic Authentication, it is useful to include the appropriate declarations in the swagger.yaml file so that client tools such as Swagger UI or Postman can automatically interpret that information and give the user the option to specify authentication headers. However, whether the server supports Basic Authentication can depend upon whether the server is a development or production server. It is also possible that you want to expose the /swagger.json endpoint that self-documents the REST APIs, but, only for development or test or sandbox systems and not in production environment.

To meet these needs, you can specify an API template that the REST framework includes with the API at runtime. You can specify that an API template affects only a single API, or, you can specify a template as the global default. Both of the API declarations and default template are sensitive to the server and env properties in a similar manner to other configuration files. Thus, you can specify that the REST framework publish an API to a specific server only, or, only if the server is operating in a specific server mode.

Publishing to different environments

The following example illustrates how to publish an API to a specific environment.
apis:
- name: gw.pc.systemtools.system_tools-10.0
  env: dev
- name: gw.pl.framework.api_list-1.0
defaultTemplate:
- name: gw.pl.framework.dev_template-1.0
- name: customer.framework.prod_template-1.0
  env : dev
In this example, notice the following:
  • The apis element lists multiple API names. The first API on the list is active in a dev environment only. The last API (gw.pl.framework.api_list-1.0) is active in all environments.
  • The default template is gw.pl.framework.dev_template-1.0. It is active in all environments except a development (dev) environment.
  • The template to use in a development (dev) environment is customer.framework.prod_template-1.0.