Supported Data Types
Overview
This topic lists the supported data types for the resource attributes in REST API services.
These are generic data types supported for REST resources, and are not specific to CPQ resources.
Data Type | Description |
---|---|
string |
A JSON string is similar to a C or Java string.Note: The date and datetime values are also represented as a JSON string conforming to the ISO 8601 format.For example, data type for DateValidated is string (date) and LastUpdateDate is string (date-time). |
boolean |
A JSON boolean. |
number |
A JSON number. This data type doesn't include the octal and hexadecimal formats. |
integer |
A JSON number without a fraction part or an exponent part. |
null |
The JSON null value. |
object |
A JSON object is an unordered set of name and value pairs. A name is a string and a value is a string, number, boolean, null, object, or array. |
array |
A JSON array is an ordered collection of values. |
JSON Syntax for CPQ Attributes
This section shows the JSON syntax for CPQ attributes.
Commerce Array Sets (Transaction Arrays)
Commerce array attribute values must be set as items under their parent array set, as shown in the following JSON example of a Commerce array set with four attributes.
{ "hasMore": false, "links": [{ … } ], "items": [{ "hours": 2, "endDate": "2021-11-30", "description": null, "requiredService": false, "_currency_pref": { "id": 5190368, "currencyCode": "USD", "links": [{ … } ], }, "region": "North America", "hourlyRate": { "value": 50.0, "currency": "USD" }, "_row_number": 1, "startDate": "2021-11-18", "laborCategory": { "displayValue": "Administration Services", "value": "administrationServices" }, "links": [{ … } ], }, { "hours": 12, "endDate": "2021-11-30", "description": null, "requiredService": false, "_currency_pref": { "id": 5190368, "currencyCode": "USD", "links": [{ … } ], }, "region": "North America", "hourlyRate": { "value": 150.0, "currency": "USD" }, "_row_number": 2, "startDate": "2021-11-18", "laborCategory": { "displayValue": "Installation Services", "value": "installationServices" }, "links": [{ … } ], }, { "hours": 3, "endDate": "2021-11-30", "description": null, "requiredService": false, "_currency_pref": { "id": 5190368, "currencyCode": "USD", "links": [{ … } ], }, "region": "North America", "hourlyRate": { "value": 150.0, "currency": "USD" }, "_row_number": 3, "startDate": "2021-11-19", "laborCategory": { "displayValue": "Upgrade Services", "value": "upgradeServices" }, "links": [{ … } ], }, { "hours": null, "endDate": "2022-11-18", "description": null, "requiredService": true, "_currency_pref": { "id": 5190368, "currencyCode": "USD", "links": [{ … } ], }, "region": "North America", "hourlyRate": { "value": 500.0, "currency": "USD" }, "_row_number": 4, "startDate": "2021-11-18", "laborCategory": { "displayValue": "Basic Maintenance Package", "value": "basicMaintenancePackage" }, "links": [{ … } ], } ] }
Refer to the following topics for information about modifying array set attributes:
The following example shows the JSON format for a Configuration array set attribute with two items.
"_setofficeServices": { "items": [{ "_index": 0, "serviceType": { "value": "Pantry Service", "displayValue": "Pantry Service" }, "startDate": "01/01/2020", "endDate": "01/01/2021" }, { "_index": 1, "serviceType": { "value": "Cleaning Service", "displayValue": "Cleaning Service" }, "startDate": "01/01/2020", "endDate": "02/01/2020" } ] }
To return an array set in the
response, include the childDef
criteria in the request.
"criteria": { "childDefs": [{ "name": "_setofficeServices", "queryDef": { "state": true, "offset": 0, "totalResults": true } } ] }
Configuration attributes that have the Set Type property set to "Set" require a composite lock mode object. The lock mode object contains two items:
- "value" is used for the attribute value
- "locked" defines the lock status of the attribute. Acceptable values are 'true' or 'false'.
Example
"oSLicenses": { "value": 3, "locked": true }
Sample Error
If you send an attribute with lock mode enabled as a name-value pair, you will receive the following error.
"Attribute osLicenses has an invalid payload."
Note: To identify attributes that have the Set Type property set to "Set", navigate to the Attributes Administration List page for the applicable Configuration model:
Admin > Products > Catalog Definition > Product Families > Product Lines > Models > Attributes
Boolean attributes are expressed as
JSON name-value pairs. Name-value pairs consist of a field name (in double
quotes), followed by a colon, and then followed by a value. Acceptable values
for Boolean attributes are: 'true
' or 'false
'
Example
"redundantPowerSupply": true
Sample Error
If an unacceptable value is sent, you will receive the following error:
Unrecognized token 'yes': was expecting ('true', 'false' or 'null')
Country and State attributes are composite JSON objects that allow customers to request the list of Countries as well as the list of States for the selected Country.
Request Body Sample
{ "criteria": { "state": true, "actions": [], "groups": [], "fields": ["_id", "_bill_to_country", "_bill_to_state"] }, "documents": { "_bill_to_country": { "value": "United States" }, "_bill_to_state": { "value": "Utah" } } }
Response Body Sample
The
available values are returned in the response "_state
" object. The "domainRestricted
" property indicates if Country and
State domain values are restricted by the "availableElements
" list.
- If a list of elements is not
available for a Country or State object, the "
availableElements
" array will be empty, and "domainRestricted
" will be set to "false
" to allow entry of values. - "
domainRestricted
" is also set to "false
" if the corresponding Country or State objects are set up as text fields in Oracle CPQ Administration.
{ "documents": { "_bill_to_country": { "value": "United States", "displayValue": "United States" }, "_id": 19642780, "_bill_to_state": { "value": "Utah", "displayValue": "Utah" }, ... "_state": { ... "attributes": { "_bill_to_country": { ... "hasError": false, "domain": { ... "availableElements": [{ "value": "United States", "displayValue": "United States" }, ...] } }, "_bill_to_state": { ... "hasError": false, "domain": { ... "availableElements": [{ "value": "Alabama", "displayValue": "Alabama" }, { "value": "Alaska", "displayValue": "Alaska" }, ...] } } } } } }
Currency attributes are expressed as composite JSON objects that contain "value
" and "currency
"
items.
Example
"price": { "value": 3.33, "currency": "USD" }
Sample Error
If you send a currency attribute as a name-value pair, you will receive the following error.
"Attribute price has an invalid payload."
Date attributes are expressed as name-value pairs that consist of a field name (in double quotes), followed by a colon, and then followed by a value.
Note: You should ensure that the date complies with the application settings and the user profile.
Example
"dateModified": "01/18/2019"
Sample Error
If the date is not formatted correctly, you will receive the following error:
"Attribute dateModified has an invalid payload."
Float attributes are floating point numbers with decimal values that are expressed as JSON name-value pairs. The name-value pairs consist of a field name (in double quotes), followed by a colon, and then followed by a value.
Example
"duration": 6.5
Sample Error
If Data Validation is set for the attribute and an invalid value is sent, you will receive the following error:
"Invalid value from punchin. Float Attribute must be in the range of 0.0 to 12.0 inclusive. Attempt to set value 25.0 failed."
Integer attributes are whole numbers (i.e. numbers without decimal values) that are expressed as JSON name-value pairs. The name-value pairs consist of a field name (in double quotes), followed by a colon, and then followed by a value.
Example
"quantity": 4
Sample Error
If a decimal value is sent, you will receive the following error:
"Invalid value from punchin. Value 2.5 for attribute Quantity should be a integer number.
The current language value and the domain of all languages for an attribute can be requested using REST services.
Request Body Sample
{ "cacheInstanceId": "-1", "delta": false, "criteria": { "state": true, "actions": [], "groups": [], "fields": ["bs_id", "displayHistoryLanguage"] } }
Response Body Sample
{ "documents": { "bs_id": "19638792", "displayHistoryLanguage": { "value": "en", "displayValue": "English" }, "links": [{ "rel": "self", "href": "https://sitename.oracle.com/rest/v13/commerceDocumentsTransaction/19638792" }, { "name": "lineItem", "rel": "child", "href": "https://sitename.oracle.com/rest/v13/commerceDocumentsTransaction/19638792/lineItem", "kind": "" } ], "_state": { "updatable": true, "hasError": false, "attributes": { "bs_id": { "updatable": false, "hasError": false, "visible": true, "hasConstraintViolation": false, "domain": { "constraintList": [] } }, "displayHistoryLanguage": { "updatable": true, "hasError": false, "visible": true, "hasConstraintViolation": false, "domain": { "constraintType": "DISALLOWED", "constraintList": [], "availableElements": [{ "value": "no_NO", "displayValue": "Norwegian (Bokm??l)[Norway]" }, { "value": "fr_CA", "displayValue": "French [Canada]" }, { "value": "en", "displayValue": "English" }, { "value": "zh_TW", "displayValue": "Chinese (Traditional) [Taiwan]" }, { "value": "ru_RU", "displayValue": "Russian [Russia]" } } ] } } } }, "cacheInstanceId": "Aq9z0FTm8gYbJk6gzBcY0p29YUH1bVHGhi4mhPeNR6dPBeohCZ6ixt8OMTkDuOh9" }
Multi-Select Menu attributes use an array of composite objects that contain "value" and "displayValue" items. Even if only one item is selected, the request must be sent as an array.
Example
"servicesRequested": { "items": [{ "value": "Network Technician", "displayValue": "Network Technician" }, { "value": "Security Analyst", "displayValue": " Security Analyst" } ] }
Sample Error
If a Multi-Select Menu attribute is not sent as an array item, you will receive the following error:
"Attribute servicesRequested has an invalid payload."
Single Select Menu attributes use composite objects that contain "value" and "displayValue" items.
Example
"cloudStorage": { "value": "500 GB", "displayValue": "500 GB" }
Sample Error
If you send a Single Select Menu attribute as a name-value pair, you will receive the following error.
"Attribute cloudStorage has an invalid payload."
Text attributes are expressed as JSON name-value pairs. Name-value pairs consist of a field name (in double quotes), followed by a colon, and then followed by a value. Enclose text string in double quotes.
Example
"enclosure": "Vision Blade 6000 Chassis"
Sample Error
If the text string is not enclosed in quotes, you will receive the following error:
Unrecognized token 'Vision': was expecting ('true', 'false' or 'null')