Testing requests and responses

Developers who work with Cloud API typically use a tool that can send requests and get responses within an acceptable amount of time. Guidewire recommends Postman. This tool has the ability to:

  • Save API calls, including headers and payloads
  • Save collections of calls
  • Automatically create a collection of calls for a schema's paths by importing the Swagger schema file
  • Share collections with other developers on your team

For more information and to download the tool, see https://www.postman.com/.

Note: Swagger UI also has the capability to send requests to a working endpoint and observe responses. However, Guidewire recommends using Swagger UI only to view API definitions. The APIs in Cloud API are significantly robust. When sending requests using Swagger UI, the performance time for getting responses can be unacceptably long. Also, if you attempt to send calls from Swagger UI and log into the PolicyCenter user interface on the same machine, the two systems may attempt to share the same session, and either or both may stop working. For more information on recommended request tools, see Requests and responses.

Tutorial: Set up your Postman environment

The Cloud API documentation contains a set of tutorials that guide you through examples of how to send requests and review the responses. All of these tutorials assume the following base environment:

  • A default instance of PolicyCenter installed on your machine that contains only the Large sample data set.
  • An instance of Postman.

This tutorial walks you through the process of setting up this environment.

If your instance of PolicyCenter is installed on a different machine, you will need to adjust the endpoint URLs provided in the tutorials. Also, if you create data in addition to the Large sample data, then your responses may differ from the ones described in the tutorials.

Tutorial steps

  1. Install Postman. (For more information, refer to https://www.postman.com/.)
  2. Start PolicyCenter and load the Large sample data set.

You can test your environment by sending your first Postman request.

  1. Open Postman.
  2. Start a new request by clicking the + to the right of the Launchpad tab.
  3. Every request in Postman requires some form of authorization:
    1. Click the Authorization tab.
    2. For the Type drop-down list, select Basic Auth.
    3. In the Username field, enter aapplegate.
    4. In the Password field, enter gw.
  4. Under the Untitled Request label, make sure that GET is selected. (This is the default operation.)
  5. In the Enter request URL field, enter the following URL: http://localhost:8180/pc/rest/common/v1/activities
  6. Click the Send button to the right of the request field.

Checking your work

Once a response has been received, its payload is shown in the lower portion of the Postman interface. If your environment has been set up correctly, the first few lines of the response payload are:

{
    "count": 11,
    "data": [
        {
        "attributes": {
            "activityPattern": "uw_review_contingency",
            "activityType": {
                "code": "general",
                "name": "General"
            },
            "assignedByUser": {
                "displayName": "Alice Applegate",
                "id": "pc:105"
        },
        ...

Troubleshooting: No response

Requests can be sent only to running applications. All of the tutorials in this documentation require that PolicyCenter is running. If you send a request when the application is not running, you will see an error similar to the following:

Could not get any response

There was an error connecting to http://localhost:8180/pc/rest/common/v1/activities.

Troubleshooting: NotFoundException

Unless it is stated otherwise, all of the tutorials use basic authentication and the aapplegate user. If you encounter a NotFoundException such as the following example, this could be caused by not providing correct authentication information for this user.

"status": 404,
"errorCode": "gw.api.rest.exceptions.NotFoundException",
"userMessage": "No resource was found at path /common/v1/activities"