技能 编程开发 Guidewire云API初次连接测试

Guidewire云API初次连接测试

v20260423
guidewire-hello-world
本技能为用户提供了连接Guidewire核心云API(如保单中心、理赔中心)的基础指南。它展示了如何执行初次RESTful API调用,查询账户和理赔记录,并详细介绍了API的响应结构、分页机制及错误处理。适用于API连接性测试和学习保险行业标准集成模式。
获取技能
405 次下载
概览

Guidewire Hello World

Overview

Execute your first Cloud API calls to PolicyCenter, ClaimCenter, and BillingCenter. All Guidewire Cloud APIs are RESTful with JSON payloads and follow Swagger 2.0.

Instructions

Step 1: Query PolicyCenter Accounts

const token = await getGuidewireToken();
const headers = { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' };

// List accounts
const accounts = await fetch(`${process.env.GW_PC_URL}/account/v1/accounts?pageSize=5`, { headers });
const data = await accounts.json();
data.data.forEach((acct: any) => {
  console.log(`Account: ${acct.attributes.accountNumber} | ${acct.attributes.accountHolderContact.displayName}`);
});

Step 2: Query ClaimCenter Claims

// List recent claims
const claims = await fetch(`${process.env.GW_CC_URL}/claim/v1/claims?pageSize=5`, { headers });
const claimData = await claims.json();
claimData.data.forEach((claim: any) => {
  console.log(`Claim: ${claim.attributes.claimNumber} | ${claim.attributes.status.code} | ${claim.attributes.lossDate}`);
});

Step 3: Guidewire API Response Structure

{
  "count": 42,
  "data": [
    {
      "attributes": { "accountNumber": "A000001", "...": "..." },
      "checksum": "abc123",
      "links": { "self": { "href": "/account/v1/accounts/pc:123" } }
    }
  ],
  "links": { "next": { "href": "/account/v1/accounts?pageSize=5&offsetToken=..." } }
}

Key patterns: data[] array, attributes for fields, checksum for optimistic locking, links for pagination.

Error Handling

Error Code Solution
404 Not Found Invalid endpoint path Verify /account/v1/accounts format
400 Bad Request Invalid query params Check pageSize, filter syntax
422 Unprocessable Business rule violation Read userMessage in response
409 Conflict Stale checksum Re-GET resource, use new checksum

For detailed implementation, see: implementation guide

Resources

Next Steps

For local development workflow, see guidewire-local-dev-loop.

信息
Category 编程开发
Name guidewire-hello-world
版本 v20260423
大小 4.03KB
更新时间 2026-04-28
语言