Response Format for Cart-Based APIs

API responses for the Cart-based APIs permit a structured interaction between the requesting entities and back-end operations and are composed of objects wrapped in a result object. The wrapper object used is represented by a JSONResult class while most result records are represented by the JSONRecord base class.

Based on every specific API, the records construct or JSONRecord can represent a different physical database record or a unit of information. The JSONRecord construct supports a hierarchical representation of the data when required, which is accomplished through the use of the nameResult property of the JSONRecord class.

The following table lists the wrapper classes. Note that not all listed properties are used by each vertical.

Apex Class NameParent ClassDescriptionProperties
JSONAttributeJSONRecordRepresents a single product attribute and its properties
    1<li>dataType: The data type of the attribute to indicate which native type this attribute accept: Integer, Boolean, String, Date, Datetime and so on.</li>
    2
    3 <li>inputType: The UI display of the attribute. This indicates whether an attribute should be rendered as a radio, checkbox or input box and so on.</li>
    4
    5 <li>multiselect: Flag to indicate if this is a multiselection.</li>
    6
    7 <li>values: List of possible values.</li>
    8
    9 <li>required: Specifies the required flag.</li>
    10
    11 <li>readonly: Specifies the read-only flag.</li>
    12
    13 <li>placeholder: Specifies the placeholder.</li>
    14
    15 <li>maxlength: Specifies the maxlength.</li>
    16
    17 <li>minlength: Specifies the minlength.</li>
    18
    19 <li>min: Specifies the min.</li>
    20
    21 <li>max: Specifies the max.</li>
    22
    23 <li>pattern: Specifies the pattern.</li>
    24
    25 <li>autocomplete: Specifies the autocomplete flag.</li>
    26
    27 <li>step: Specifies the step.</li>
    28
    29 <li>attributeId: Specifies the attributeId.</li>
    30
    31 <li>label: Specifies the label.</li>
    32
    33 <li>formatMask: Specifies the formatMask.</li>
    34
    35 <li>hasRules: Specifies the hasRules flag.</li>
    36
    37 <li>customTemplate: For custom rendering of the Attribute (such as Buttons)</li>
    38
    39 <li>disabled: Same as readonly.</li>
    40
    41 <li>hidden: Specifies the hidden flag.</li>
    42
    43 <li>filterable: Specifies the filterable flag.</li>
    44
    45 <li>cloneable: Specifies the cloneable flag.</li>
    46
    47 <li>description: Specifies the value description.</li>
    48
    49 <li>userValues: Specifies selected values.</li>
    50
    51 <li>isRatingAttribute: Specifies the isRatingAttribute flag.</li>
    52
    53 <li>code: Specifies the code.</li>
    54
    55 <li>rules: Specifies the list rules.</li>
    56
    57 <li>isNotTranslatable: Specifies the isNotTranslatable flag.</li>
    | |JSONCategory|JSONRecord|Represents a single product attribute category and its properties.|
    • id: The ID of the record.
    • 1<li>name: The name of the record.</li>
      2
      3 <li>childCategories: The list of the child categories.</li>
    | |JSONRecord|N/A|A value object that represents a record. A record can be an attribute, product, order, quote, opportunity or line item.|
    • messages: Informational, warning, or error message associated with this result.
    • 1<li>actions: Remote action or API that are associated with this result. For example, the action for attributes filtering will be search product.</li>
      2
      3 <li>fields: A map of name and value for fields. For example: CategoryCode__c:"Installation", CategoryCodeId:"801360000000oQ9"</li>
      4
      5 <li>nameResult: A map that contains the child JSONResult. For example, the root product JSONResult will contain a list of product records. Each record will contain a nameResult of child product result.</li>
      6
      7 <li>promotion: Promotion child products results</li>
      8
      9 <li>displaySequence: The display sequence of that record.</li>
    | |JSONAttribute.JSONValue|N/A|Represents a single Product Attribute Value.|
    • name: Unique name of the value.
    • 1<li>label: Display label of the value that could be used in dropdown, checkbox or radio button.</li>
      2
      3 <li>value: The value that will be stored.</li>
      4
      5 <li>defaultValue: Default value.</li>
      6
      7 <li>selected: Flag to indicate if this is selected or not.</li>
      8
      9 <li>defaultSelected: Default selection of the value.</li>
      10
      11 <li>readonly: Specifies the read only flag.</li>
      12
      13 <li>disabled: Specifies the disabled flag.</li>
      14
      15 <li>displaySequence: Specifies the displaySequence.</li>
    | |JSONResult|N/A|The main value object that encapsulates API responses.|
    • totalSize: The size of the records. This is the total number, not necessary the same of records.size(). For example, if there are 200 attributes and the number of records being return is 20. The totalSize will be 200. It serves as an indicator to fetch more records.
    • 1<li>messages: Informational, warning, or error message associated with this result.</li>
      2
      3 <li>actions: Remote action or API that are associated with this result. For example, the action for attributes filtering will be search product.</li>
      4
      5 <li>records: List of records.</li>
    |