Resources
The primary mechanism for passing information between the caller application and PolicyCenter is the resource. A resource is an instance of data that you can create, modify, delete, or query for. Resources are defined in JSON schema files.
Every resource has a type. The type defines the Guidewire data model entities
that the resource maps to. For example, Activity
resources map to the
Activity
data model entity. In most cases, each resource maps to a single
data model entity. However, there are some resources which map to multiple data model
entities. For example, the AccountContact
resource maps to three data model
entities in PolicyCenter: AccountContact
, Contact
, and
AccountContactRole
.
Resources contain a set of fields. Each field stores information about the resource. Depending on the context, fields are also referred to as properties or attributes.
Resources are exchanged in the payloads of the request and response objects. The
payload is a block of JSON-formatted text that contains fields from the
relevant resources and their values. The following is a portion of the response payload for an
Activity
resource.
"attributes": {
"assignedGroup": {
"displayName": "Auto1 - TeamA",
"id": "demo_sample:31"
},
"assignedUser": {
"displayName": "Andy Applegate",
"id": "demo_sample:1"
},
"dueDate": "2020-11-16T08:00:00.000Z",
"id": "xc:20",
"priority": {
"code": "urgent",
"name": "Urgent"
"subject": "Contact claimant"
}
Note that a field can store:
- A scalar value, such as the
subject
field. - A set of values, such as the
assignedUser
field. This is referred to as an inline object. - An array of objects. (There is no example of this in
Activity
. If there were, the field name would be followed by square braces ([ and ]) delimiting the array. Each array member would be listed in curly braces ({ and }).
Every resource can be uniquely defined by its resource ID. This is stored in the
resource's id
field. For example, the activity in the previous example has a
resource ID of xc:20
. For most endpoints, the id
field maps
to the data model entity's PublicID
field. (However, there are some endpoints
that map id
to a different field. For example, in PolicyCenter, the resource
ID for a line is its line prefix. This means that the line
resource on a
personal auto policy has an id
value of something similar to
PersonalAutoLine
, and not pc:114567
.)
A single resource is called an element. For example,
/contact/xc:203
is an element. (In some REST API literature, this is also
referred to as a singleton.)
A set of resources is called a collection. For example,
/contact/xc:203/addresses
(the addresses associated with contact xc:203) is
a collection.