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/.
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
- Install Postman. (For more information, refer to https://www.postman.com/.)
- Start PolicyCenter and load the Large sample data set.
You can test your environment by sending your first Postman request.
- Open Postman.
- Start a new request by clicking the + to the right of the Launchpad tab.
- Every request in Postman requires some form of authorization:
- Click the Authorization tab.
- For the Type drop-down list, select Basic Auth.
- In the Username field, enter aapplegate.
- In the Password field, enter gw.
- Under the Untitled Request label, make sure that GET is selected. (This is the default operation.)
- In the Enter request URL field, enter the following
URL:
http://localhost:8180/pc/rest/common/v1/activities
- 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"