Basic guidelines

For all successfully received web requests, I2I API use standard set of HTTP status codes to send response. The most used are:

Web API object model consists of generic entities containing set of default system properties followed by country and/or customer specific properties. All properties matching data model are contained in collection called Items. These generic data entities allow the same i2i Web API to be used for all insurance products of all Insicon customers.

Standard i2i Web API which comes out of the box with i2i-core product is consumed by both i2i back end (i2i web office) and is offered as an integration point for front ends and other integrations. Due to that fact there is certain amount of metadata in the calls.

How do I create new business objects in i2i?

Creating any business object using i2i Web API requires two method calls:

  1. Initiate
  2. Save

Initiate method will give in response JSON formatted business object that you want to create and save in i2i system. Default values configured for specific business object will be already set. Next step is to alter that object and add, change and/or remove values. Altered JSON object should than be saved with call to Save method. As a result, saved business object is returned in JSON format in case of successful method call. Each business object has validation rules that don’t allow objects to be saved without required values, so validation failure can be returned with appropriate description instead of saved object.

All business objects in i2i system are derived from Instance base class, which is derived from BaseEntity.

JSON structure for those classes is:

How can I change a field value from initiate JSON response?

For every i2i business object in JSON format it is possible to find “Items” section that is in fact actual list of columns and values for specific row in database related to that object. For initiated policy that part of JSON will look something with this:

"Items": { //The starting tag in JSON that lists all business object fields/properties
    "PolicyId": { //Name of the item. This name corresponds to column name in database
        "Type": "System.Int32" //Type of item value
    },
    "DefinitionId": {
        "Type": "System.Int32",
        "Value": 108, //This is the current value for the given column.
        "Original": 108 //This is the original value for the given column.
    },
    "VersionId": {
        "Type": "System.Int32",
        "Value": 110,
        "Original": 110
    }//, ...
}

Items – The name of the collection and it exist on every i2i business entity

Type – The .NET representation of the value type. Complete list of built-in types is presented here.

Value – This is the current value for the given column. This value complies with the type stated above. By changing this value, column value is actually changed. In cases when there is no Value tag in JSON, it should be added if it is needed to set column value.

Original – This is the original value for the given column. This original value also complies to the type stated above. In cases when business object is just initiated, with initiate API call, Value and Original Value are usually not present in the JSON data.

What is the structure of person business objects in JSON?

All parties in i2i system can be grouped in 3 main business entities:

Basic structure is the same for all party entities except for party details entity that is specific for each of them.

Just like for any other business object in i2i system, parties have Items collection that matches data model.

Following party hiararchy, each of children elements has its own Items collection. Most important and commonly used properties (items) are explained in JSON below that is taken from get person response:

What is the structure of organization business objects in JSON?

As mentioned in previous section, Organization structure is almost the same as Person structure except for entity details object that is of type definition organization details, and his child street address.

Those two exceptions are shown below:

What is the basic structure of insurance business objects in JSON?

All policy and quote instances will have same basic structure in JSON:

PolicyHolder, Insured, PremiumPayer and Insurer are direct descendants of the Policy element and they are part of the policy Children collection in JSON request/response. When saving policy, it is necessary to set PolicyHolder, Insured and Premium payer elements to point out to the signed in user. All users upon signing-in to i2i, will have PartyId field set (check Login response example) and this value needs to be used for insurance parties EmbeddedInstanceId value. EmbeddedDefinitionId value in this case will always have value 1 which is a statement that this party is in fact person, and not an organization or organization unit. 4th insurance party called Insurer is not mandatory – it is only relevant to broker companies.

ProductPart is maybe the most interesting element in the policy structure since that is the place where all specific product details are.

Below Product details, list of coverages can be found. This list heavily depends on business package that is used for creating this insurance.

How can I register a new person in i2i?

If you want to register a new Person business object in i2i system using i2i Web API, you need to follow steps described in How do I create new business objects in i2i? using method calls specific to Party business module:

  1. Initiate party with definitionId = 1
  2. Alter JSON response and add values, as described in: How can I change a field value from initiate JSON response?
  3. Save altered response using call to Save method

How can I remove coverage element from insurance?

When initiating or retrieving quote/policy data, complete structure of an insurance is returned in JSON format. On specific level of hierarchy, as defined in i2i Designer, insurance coverages can be found. Those sections of JSON will look like this:

"Children": [
    {
        "$id": "15",
        "$type": "I2I.Logic.Component.Products.Entity.Coverage, I2I.Logic.Component.Products.Entity",
        "Guid": "d90c9b95-397b-4ec7-8f8d-dc101a6f6bd9",
        "Children": [], // The list of subcoverages, if any
        "Parent": {
            "$ref": "9"
        },
        "Lookups": { }, // List of coverage lookups
        "PrimaryKey": "MTPLInsuranceId", // The name of the item used to uniqly identify instance in i2i database
        "Id": 154146, // The value of primary key item
        "Status": 0, // State of a business object, whether it is unchanged, added, changed or deleted
        "Items": {
            "MTPLInsuranceId": {
                "Type": "System.Int32",
                "Value": 154146,
                "Original": 154146
            },
            "DefinitionId": {
                "Type": "System.Int32",
                "Value": 2500071,
                "Original": 2500071
            },
            "VersionId": {
                "Type": "System.Int32",
                "Value": 2500080,
                "Original": 2500080
            },
            "PartId": {
                "Type": "System.Int32",
                "Value": 2000192,
                "Original": 2000192
            },
            "ConfigurationId": {
                "Type": "System.Int32",
                "Value": 2501694,
                "Original": 2501694
            },
            "ParentPartId": {
                "Type": "System.Int32",
                "Value": 2500014,
                "Original": 2500014
            },
            "ParentId": {
                "Type": "System.Int32",
                "Value": 1254943,
                "Original": 1254943
            },
            "RootId": {
                "Type": "System.Int32",
                "Value": 1412186,
                "Original": 1412186
            },
            "AnnualPremium": {
                "Type": "System.Decimal",
                "Value": 1200,
                "Original": 0
            },
            "Premium": {
                "Type": "System.Decimal",
                "Value": 1200,
                "Original": 0
            }
        }
    }
]

If a coverage was not already saved, then its complete JSON element can be removed. This is distinguished by value of the “Status”. Status value 1 “Added” means that it was not saved.

If a coverage was already saved (Status is different than 1) then the Status needs to be set to 3 (“Deleted”) and sent like that to the Save method

Complete list of possible Status values for any i2i business object is stated below:

What are the Lookups?

Lookups are most commonly used for containing values of related entities which are not fully loaded with the current entity. A typical example is policy holder’s name on policy entity. Lookup values exist on GET calls, while on INITIATE calls they are mainly empty. Lookups can appear on any level of quote/policy hiearachy and its structure is like this:

"Lookups": {
    "$id": "16",
    "Status": -1,
    "Items": {
    "PartyName": { - The name of the lookup
        "Type": "System.String",
        "Value": “John Doe”, - This field reflects the value of PartyName lookup
        "Original": “John Doe”
    }, 
    //...
}

For complete list of lookups on various levels of an insurance, please see JSON responses in Quotation and Policies APIs.

How can I attach a photo image to field value in JSON request?

Photo can be added to element in JSON only as base64 string. Usually, photo fields can be distinguished with value for Type JSON tag - it is always: “System.Byte[]”. By simply setting Value tag with image base64 text representation, image content will be saved in database. There are some online converters that can be used as a check of base64 string encoding, like base64-image.de which will generate data acceptable by i2i web API (this tool will append some prefix for image converters that are used, like “data:image/jpg;base64,” but this prefixes should not be used when sending requests, only pure base64 string representation of the image).