---
schema_version: "1"
id: 5cd04f07d61008cc06405b9fa5d1b3c04ad87811d0dc662b1f2b9299f1988a8e
title: getRatingInput(insGetRatingInputInputRepresentation)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/apex_ConnectAPI_InsuranceDesignAdvisorFamily_getRatingInput_1.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_ConnectAPI_InsuranceDesignAdvisorFamily_getRatingInput_1.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: cf6e2482fc5fa240f06079cb38825eb79f74392f5921c210d57c5c68669c3e5e
description: Generate a sample rating input for the specified insurance product, and use the generated rating input as the request body in the Insurance Product Rating API after replacing sample values with real data.
---
# getRatingInput(insGetRatingInputInputRepresentation)

Generate a sample rating input for the specified insurance product, and use the generated rating input as the request body in the Insurance Product Rating API after replacing sample values with real data.

## API Version

68.0

## Requires Chatter

No

## Signature

public static ConnectApi.InsGetRatingInputRepresentation getRatingInput(ConnectApi.InsGetRatingInputInputRepresentation insGetRatingInputInputRepresentation)

## Parameters

insGetRatingInputInputRepresentation

Type: [ConnectApi.InsGet​Rating​Input​InputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_input_ins_get_rating_input.htm "Input representation that specifies the product for which to generate a sample rating input payload.")

Required. Input that identifies the root Product2 record for which to generate a sample rating input payload.

## Return Value

Type: [ConnectApi.InsGet​Rating​Input​Representation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_output_ins_get_rating_input.htm "Output representation that contains the generated sample rating input payload as a JSON string, or errors if generation fails.")

## Usage

Use this method at design time to generate a sample rating input payload for a root insurance product. Provide a Product2 ID. The method traverses the product hierarchy, including bundles, components, and attributes, builds a fully populated sample request body suitable for the Insurance Product Rating API, and returns it as a JSON string in ratingInput.

The generated payload includes product codes, instance keys, and attribute codes with sample values. Parse the ratingInput string, replace sample values with real data, and then submit the result to the product-rating API. Review additionalDetails for guidance about fields the sample may omit, such as transactionType.

When generation succeeds, ratingInput contains the sample payload and errors is empty or null. When generation fails, errors lists the failures. Examples include:

- SF-INS-DSAV-00013 — a product ID is required. Specify a valid product ID.
- SF-INS-DSAV-00014 — the specified product ID doesn’t exist or isn’t accessible.

## Example

This sample generates a rating input payload from Apex.

ConnectApi.InsGetRatingInputInputRepresentation input =
    new ConnectApi.InsGetRatingInputInputRepresentation();
input.productId = '01txx0000006i3DAAQ';

ConnectApi.InsGetRatingInputRepresentation result =
    ConnectApi.InsuranceDesignAdvisorFamily.getRatingInput(input);

System.debug('ratingInput=' + result.ratingInput);
System.debug('additionalDetails=' + result.additionalDetails);
System.debug('errors=' + result.errors);