Creating the Activity JSON schema
The Guidewire REST API framework uses JSON schema files to define the input and output for the REST APIs. Place the JSON schema file that you create in the following directory in Guidewire Studio Project window:
The example Activities API uses mc/activityapi as the name space (base
path) for the API configuration files that you need to create in sub-directories of the
Studio Integration directory. The file names of the API configuration
files that you create must also contain an ending
-1.0 designation. For
example, name the JSON file that you create something similar to the following example:- activityAPI-1.0.schema.json
Use the following fully qualified path to the JSON schema file in code:
- mc.activityapi.activityAPI-1.0
Important: It is important to generate the JSON schema wrapper classes
before you construct any handler class that uses those JSON objects. See JSON schema wrapper types for more information.
Example JSON schema for the Activity API
The example JSON schema defines the following JSON objects:
ActivityDetailobjectActivitySummaryobjectAssignedUserobjectNewActivityobjectRelatedContactobjectRelatedAccountobjectRelatedJobobjectRelatedPolicyobject
The following code sample is an example of the JSON schema for the Activities
API.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"ActivityDetail" : {
"type" : "object",
"properties" : {
"approvalRationale" : {
"type" : "string"
},
"assignedUser" : {
"$ref" : "#/definitions/AssignedUser"
},
"description" : {
"type" : "string"
},
"escalationDate" : {
"type" : "string",
"format" : "date-time"
},
"mandatory" : {
"type" : "boolean"
},
"priority" : {
"type" : "string",
"x-gw-type" : "typekey.Priority"
},
"publicId" : {
"type" : "string"
},
"relatedAccount" : {
"$ref" : "#/definitions/RelatedAccount"
},
"relatedContact" : {
"$ref" : "#/definitions/RelatedContact"
},
"relatedJob" : {
"$ref" : "#/definitions/RelatedJob"
},
"relatedPolicy" : {
"$ref" : "#/definitions/RelatedPolicy"
},
"relatedPolicyPeriod" : {
"$ref" : "#/definitions/RelatedPolicyPeriod"
},
"status" : {
"type" : "string",
"x-gw-type" : "typekey.ActivityStatus"
},
"subject" : {
"type" : "string"
},
"targetDate" : {
"type" : "string",
"format" : "date-time"
}
}
},
"ActivitySummary" : {
"type" : "object",
"properties" : {
"assignedUser" : {
"$ref" : "#/definitions/AssignedUser"
},
"escalated" : {
"type" : "boolean"
},
"escalationDate" : {
"type" : "string",
"format" : "date-time"
},
"mandatory" : {
"type" : "boolean"
},
"priority" : {
"type" : "string",
"x-gw-type" : "typekey.Priority"
},
"publicId" : {
"type" : "string"
},
"status" : {
"type" : "string",
"x-gw-type" : "typekey.ActivityStatus"
},
"subject" : {
"type" : "string"
},
"targetDate" : {
"type" : "string",
"format" : "date-time"
}
}
},
"AssignedUser" : {
"type" : "object",
"properties" : {
"displayName" : {
"type" : "string"
},
"publicId" : {
"type" : "string"
},
"username" : {
"type" : "string"
}
}
},
"NewActivity" : {
"properties" : {
"activityPattern" : {
"type" : "string"
},
"accountNumber" : {
"type" : "string"
},
"subject" : {
"type" : "string"
},
"description" : {
"type" : "string"
},
"jobNumber" : {
"type" : "string"
},
"priority" : {
"type" : "string",
"x-gw-type" : "typekey.Priority"
},
"mandatory" : {
"type" : "boolean"
},
"targetDate" : {
"type" : "string",
"format" : "date-time"
},
"escalationDate" : {
"type" : "string",
"format" : "date-time"
}
}
},
"RelatedAccount" : {
"type" : "object",
"properties" : {
"accountNumber" : {
"type" : "string"
},
"displayName" : {
"type" : "string"
},
"publicId" : {
"type" : "string"
}
}
},
"RelatedContact" : {
"type" : "object",
"properties" : {
"displayName" : {
"type" : "string"
},
"publicId" : {
"type" : "string"
}
}
},
"RelatedJob" : {
"type" : "object",
"properties" : {
"displayName" : {
"type" : "string"
},
"jobNumber" : {
"type" : "string"
},
"jobType" : {
"type" : "string",
"x-gw-type" : "typekey.Job"
},
"publicId" : {
"type" : "string"
}
}
},
"RelatedPolicy" : {
"type" : "object",
"properties" : {
"displayName" : {
"type" : "string"
},
"publicId" : {
"type" : "string"
}
}
},
"RelatedPolicyPeriod" : {
"type" : "object",
"properties" : {
"displayName" : {
"type" : "string"
},
"policyNumber" : {
"type" : "string"
},
"publicId" : {
"type" : "string"
}
}
}
}
}
