validateApiRequest(insRequestValidationInputRepresentation)
Validate a JSON request body for the Insurance Quote or Insurance Product Rating API by checking product codes, attributes, instance keys, and required fields against the configured product model.
68.0
No
public static ConnectApi.InsRequestValidationRepresentation validateApiRequest(ConnectApi.InsRequestValidationInputRepresentation insRequestValidationInputRepresentation)
- insRequestValidationInputRepresentation
Type:
ConnectApi.InsRequestValidationInputRepresentationRequired. Input that specifies the insurance Connect API path and the serialized JSON request body to validate.
Type: ConnectApi.InsRequestValidationRepresentation
Use this method at design time to pre-validate an Insurance Connect API request body before submission. Provide an API path such as insurance/quotes or insurance/product-rating, and a serialized JSON request body. The method verifies product references, hierarchy relationships, instance keys, attribute definitions, and JSON structure, and returns actionable findings for any detected issues.
Validation includes these checks:
- Product code existence and active status
- Parent-child hierarchy structure in
quoteLineItems/salesTransactionItemsand nestedchildProducts - Non-empty
instanceKeyarrays ininstanceKeysentries - Attribute code existence and active status against registered
AttributeDefinitionrecords - JSON parse validation for the request body string
For unsupported API paths, the method returns a valid result with an informational message rather than an error. Supported paths are insurance/quotes and insurance/product-rating.
When validation succeeds, isValid is true and results is empty or contains only informational findings. When validation finds issues, isValid is false and results lists the findings. When required input is missing, errors can include request-level failures such as:
SF-INS-DSAV-00041— the request payload is required. Provide a valid JSON payload and API path.
This sample validates an API request payload from Apex.