Back to Collection Items
IncludeFile "CkJsonObject.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkHttp.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
; Adds the "Authorization: Bearer <access_token>" header.
CkHttp::setCkAuthToken(http, "<access_token>")
sbResponseBody.i = CkStringBuilder::ckCreate()
If sbResponseBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkHttp::ckQuickGetSb(http,"https://domain.com/services/data/v{{version}}/connect/business-rules/expression-set/:expressionSetId",sbResponseBody)
If success = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkStringBuilder::ckDispose(sbResponseBody)
ProcedureReturn
EndIf
jResp.i = CkJsonObject::ckCreate()
If jResp.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoadSb(jResp,sbResponseBody)
CkJsonObject::setCkEmitCompact(jResp, 0)
Debug "Response Body:"
Debug CkJsonObject::ckEmit(jResp)
respStatusCode.i = CkHttp::ckLastStatus(http)
Debug "Response Status Code = " + Str(respStatusCode)
If respStatusCode >= 400
Debug "Response Header:"
Debug CkHttp::ckLastHeader(http)
Debug "Failed."
CkHttp::ckDispose(http)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndIf
; Sample JSON response:
; (Sample code for parsing the JSON response is shown below)
; {
; "apiName": "myExpressionSet",
; "contextDefinitions": [
; ],
; "id": "9QLHo000000LBjEOAW",
; "name": "myExpressionSet",
; "usageType": "Bre",
; "versions": [
; {
; "apiName": "myExpressionSet_V1",
; "description": "myExpressionSet V1 Description",
; "enabled": true,
; "id": "9QMHo000000LBjJOAW",
; "name": "myExpressionSet V1",
; "rank": 1,
; "showExplExternally": true,
; "startDate": "2023-09-06T09:27:06.000Z",
; "steps": [
; {
; "actionType": "AssignParameterValues",
; "assignment": {
; "assignedParameter": "condition_output__1",
; "expression": "true"
; },
; "description": "my Description",
; "name": "myCalculation",
; "resultIncluded": true,
; "sequenceNumber": 1,
; "shouldExposeConditionDetails": false,
; "shouldExposeExecPathMsgOnly": true,
; "shouldShowExplExternally": false,
; "stepType": "BusinessKnowledgeModel"
; }
; ],
; "variables": [
; {
; "collection": false,
; "dataType": "Boolean",
; "description": "condition_output__1",
; "input": false,
; "name": "condition_output__1",
; "output": true,
; "type": "Variable",
; "value": "False"
; },
; {
; "collection": false,
; "dataType": "Boolean",
; "description": "condition_output__2",
; "input": false,
; "name": "condition_output__2",
; "output": false,
; "type": "Variable",
; "value": "False"
; }
; ],
; "versionNumber": 1
; }
; ]
; }
; Sample code for parsing the JSON response...
; Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
description.s
enabled.i
rank.i
showExplExternally.i
startDate.s
versionNumber.i
j.i
count_j.i
actionType.s
AssignedParameter.s
Expression.s
resultIncluded.i
sequenceNumber.i
shouldExposeConditionDetails.i
shouldExposeExecPathMsgOnly.i
shouldShowExplExternally.i
stepType.s
collection.i
dataType.s
input.i
output.i
v_type.s
value.s
apiName.s = CkJsonObject::ckStringOf(jResp,"apiName")
id.s = CkJsonObject::ckStringOf(jResp,"id")
name.s = CkJsonObject::ckStringOf(jResp,"name")
usageType.s = CkJsonObject::ckStringOf(jResp,"usageType")
i.i = 0
count_i.i = CkJsonObject::ckSizeOfArray(jResp,"contextDefinitions")
While i < count_i
CkJsonObject::setCkI(jResp, i)
i = i + 1
Wend
i = 0
count_i = CkJsonObject::ckSizeOfArray(jResp,"versions")
While i < count_i
CkJsonObject::setCkI(jResp, i)
apiName = CkJsonObject::ckStringOf(jResp,"versions[i].apiName")
description = CkJsonObject::ckStringOf(jResp,"versions[i].description")
enabled = CkJsonObject::ckBoolOf(jResp,"versions[i].enabled")
id = CkJsonObject::ckStringOf(jResp,"versions[i].id")
name = CkJsonObject::ckStringOf(jResp,"versions[i].name")
rank = CkJsonObject::ckIntOf(jResp,"versions[i].rank")
showExplExternally = CkJsonObject::ckBoolOf(jResp,"versions[i].showExplExternally")
startDate = CkJsonObject::ckStringOf(jResp,"versions[i].startDate")
versionNumber = CkJsonObject::ckIntOf(jResp,"versions[i].versionNumber")
j = 0
count_j = CkJsonObject::ckSizeOfArray(jResp,"versions[i].steps")
While j < count_j
CkJsonObject::setCkJ(jResp, j)
actionType = CkJsonObject::ckStringOf(jResp,"versions[i].steps[j].actionType")
AssignedParameter = CkJsonObject::ckStringOf(jResp,"versions[i].steps[j].assignment.assignedParameter")
Expression = CkJsonObject::ckStringOf(jResp,"versions[i].steps[j].assignment.expression")
description = CkJsonObject::ckStringOf(jResp,"versions[i].steps[j].description")
name = CkJsonObject::ckStringOf(jResp,"versions[i].steps[j].name")
resultIncluded = CkJsonObject::ckBoolOf(jResp,"versions[i].steps[j].resultIncluded")
sequenceNumber = CkJsonObject::ckIntOf(jResp,"versions[i].steps[j].sequenceNumber")
shouldExposeConditionDetails = CkJsonObject::ckBoolOf(jResp,"versions[i].steps[j].shouldExposeConditionDetails")
shouldExposeExecPathMsgOnly = CkJsonObject::ckBoolOf(jResp,"versions[i].steps[j].shouldExposeExecPathMsgOnly")
shouldShowExplExternally = CkJsonObject::ckBoolOf(jResp,"versions[i].steps[j].shouldShowExplExternally")
stepType = CkJsonObject::ckStringOf(jResp,"versions[i].steps[j].stepType")
j = j + 1
Wend
j = 0
count_j = CkJsonObject::ckSizeOfArray(jResp,"versions[i].variables")
While j < count_j
CkJsonObject::setCkJ(jResp, j)
collection = CkJsonObject::ckBoolOf(jResp,"versions[i].variables[j].collection")
dataType = CkJsonObject::ckStringOf(jResp,"versions[i].variables[j].dataType")
description = CkJsonObject::ckStringOf(jResp,"versions[i].variables[j].description")
input = CkJsonObject::ckBoolOf(jResp,"versions[i].variables[j].input")
name = CkJsonObject::ckStringOf(jResp,"versions[i].variables[j].name")
output = CkJsonObject::ckBoolOf(jResp,"versions[i].variables[j].output")
v_type = CkJsonObject::ckStringOf(jResp,"versions[i].variables[j].type")
value = CkJsonObject::ckStringOf(jResp,"versions[i].variables[j].value")
j = j + 1
Wend
i = i + 1
Wend
CkHttp::ckDispose(http)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndProcedure
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/connect/business-rules/expression-set/:expressionSetId
Postman Collection Item JSON
{
"name": "Expression Set Retrieve",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/connect/business-rules/expression-set/:expressionSetId",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"connect",
"business-rules",
"expression-set",
":expressionSetId"
],
"variable": [
{
"key": "expressionSetId",
"value": "9QLHo000000LBngOAG",
"description": "Expression Set Id: For Example 9QLHo000000LBjEOAW"
}
]
},
"description": "# Expression Set Retrieve and Delete (DELETE, GET)\n\nEndpoints to read, and delete expression set.Resource\n\n```\n/connect/business-rules/expression-set/${expressionSetId}\n\n ```\n\nResource Example\n\n```\nhttps://yourInstance.salesforce.com/services/data/v59.0/connect\n /business-rules/expressionSet/$11Oxx0000006PcLEAU\n\n ```\n\nAvailable version\n\n58.0\n\nRequires Chatter\n\nNo\n\nHTTP methods\n\nDELETE, GET\n\nRequest body for GET\n\nRoot XML tag\n\nJSON example\n\n```\n{\n \"name\": \"CTX Mapping ES\",\n \"apiName\": \"CTX_Mapping_ES_1\",\n \"description\": \"...\",\n \"usageType\": \"Bre\",\n \"contextDefinitions\": [\n {\n \"id\": \"11Oxx0000006PcLEAU\"\n }\n ],\n \"versions\": [\n {\n \"name\": \"CTX_Mapping_ES_1 V1\",\n \"apiName\": \"CTX_Mapping_ES_1_V1\",\n \"description\": \"Sample CTX Mapping\",\n \"startDate\": \"2022-11-14T20:31:47.000+0000\",\n \"endDate\": \"2022-11-14T20:31:47.000+0000\",\n \"versionNumber\": 1,\n \"rank\": 1,\n \"enabled\": true,\n \"showExplExternally\": false,\n \"steps\": [\n {\n \"name\": \"Condition1\",\n \"description\": \"Condition step for conditions w.r.t product\",\n \"sequenceNumber\": 1,\n \"resultIncluded\": true,\n \"stepType\": \"Condition\",\n \"conditionExpression\": {\n \"expression\": \"productName == 'iPhone' && productColor == 'Red'\",\n \"resultParameter\": \"condition_output__1\"\n }\n }\n ],\n \"variables\": [\n {\n \"name\": \"productName\",\n \"collection\": false,\n \"dataType\": \"Text\",\n \"description\": \"productName\",\n \"input\": true,\n \"output\": false,\n \"type\": \"Variable\"\n },\n {\n \"name\": \"productColor\",\n \"collection\": false,\n \"dataType\": \"Text\",\n \"description\": \"productColor\",\n \"input\": true,\n \"output\": false,\n \"type\": \"Variable\"\n },\n {\n \"name\": \"condition_output__1\",\n \"dataType\": \"Boolean\",\n \"description\": \"condition_output__1\",\n \"input\": false,\n \"output\": true,\n \"resultStep\": \"Condition1\",\n \"type\": \"Variable\"\n }\n ]\n }\n ]\n}\n\n ```\n\nProperties\n\n| Name | Type | Description | Required or Optional | Available Version |\n| --- | --- | --- | --- | --- |\n| apiName | String | Unique name of the expression set. | Required | 58.0 |\n| contextDefinitions | [Context Definition Input](https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_requests_context_definition_input.htm) | List of context definitions in an expression set. | Optional | 58.0 |\n| description | String | Description of the expression set. | Optional | 58.0 |\n| name | String | Name of the expression set. | Required | 58.0 |\n| usageType | String | Usage type of the expression set. <br> <br>Valid values are: <br> <br>\\- AiAcceleratorSubscriberChurnPrediction—Used for Industries Einstein <br> <br>\\- Bre—Used for Business Rules Engine <br> <br>\\- CustomLoyalty—Used for Loyalty Management <br> <br>\\- DefaultPricing—Used for Pricing Plans in Enterprise Product Catalog (EPC) by Communications Cloud <br> <br>\\- Qualification—Used for Industries Communications, Media, and Energy (CME) <br> <br>\\- RecordAlert—Used for Financial Services Cloud <br> <br>\\- ShipAndDebit—Used for Manufacturing Cloud <br> <br>\\- TierProcessing—Used for Loyalty Management <br> <br>\\- TransactionJournal—Used for Loyalty Management <br> <br>\\- WarrantyClaim—Used for Manufacturing Cloud | Required | 58.0 |\n| versions | [Expression Set Version Input](https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_requests_expression_set_version.htm)\\[\\] | List of the expression set versions. | Optional | 58.0 |\n\nResponse body for GET[Expression Set Output](https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_responses_expression_set_output.htm)"
},
"response": [
{
"name": "Status200-RecordFound",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/connect/business-rules/expression-set/:expressionSetId",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"connect",
"business-rules",
"expression-set",
":expressionSetId"
],
"variable": [
{
"key": "expressionSetId",
"value": "9QLHo000000LBjEOAW",
"description": "Expression Set Id: For Example 9QLHo000000LBjEOAW"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 06 Sep 2023 09:34:42 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Robots-Tag",
"value": "none"
},
{
"key": "Cache-Control",
"value": "no-cache,must-revalidate,max-age=0,no-store,private"
},
{
"key": "Content-Type",
"value": "application/json;charset=UTF-8"
},
{
"key": "Vary",
"value": "Accept-Encoding"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "{\n \"apiName\": \"myExpressionSet\",\n \"contextDefinitions\": [],\n \"id\": \"9QLHo000000LBjEOAW\",\n \"name\": \"myExpressionSet\",\n \"usageType\": \"Bre\",\n \"versions\": [\n {\n \"apiName\": \"myExpressionSet_V1\",\n \"description\": \"myExpressionSet V1 Description\",\n \"enabled\": true,\n \"id\": \"9QMHo000000LBjJOAW\",\n \"name\": \"myExpressionSet V1\",\n \"rank\": 1,\n \"showExplExternally\": true,\n \"startDate\": \"2023-09-06T09:27:06.000Z\",\n \"steps\": [\n {\n \"actionType\": \"AssignParameterValues\",\n \"assignment\": {\n \"assignedParameter\": \"condition_output__1\",\n \"expression\": \"true\"\n },\n \"description\": \"my Description\",\n \"name\": \"myCalculation\",\n \"resultIncluded\": true,\n \"sequenceNumber\": 1,\n \"shouldExposeConditionDetails\": false,\n \"shouldExposeExecPathMsgOnly\": true,\n \"shouldShowExplExternally\": false,\n \"stepType\": \"BusinessKnowledgeModel\"\n }\n ],\n \"variables\": [\n {\n \"collection\": false,\n \"dataType\": \"Boolean\",\n \"description\": \"condition_output__1\",\n \"input\": false,\n \"name\": \"condition_output__1\",\n \"output\": true,\n \"type\": \"Variable\",\n \"value\": \"False\"\n },\n {\n \"collection\": false,\n \"dataType\": \"Boolean\",\n \"description\": \"condition_output__2\",\n \"input\": false,\n \"name\": \"condition_output__2\",\n \"output\": false,\n \"type\": \"Variable\",\n \"value\": \"False\"\n }\n ],\n \"versionNumber\": 1\n }\n ]\n}"
},
{
"name": "Status404-RecordNotFound",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/connect/business-rules/expression-set/:expressionSetId",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"connect",
"business-rules",
"expression-set",
":expressionSetId"
],
"variable": [
{
"key": "expressionSetId",
"value": "9QLHo000000LBjEOA",
"description": "Expression Set Id: For Example 9QLHo000000LBjEOAW"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 06 Sep 2023 09:56:59 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Robots-Tag",
"value": "none"
},
{
"key": "Cache-Control",
"value": "no-cache,must-revalidate,max-age=0,no-store,private"
},
{
"key": "Content-Type",
"value": "application/json;charset=UTF-8"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "[\n {\n \"errorCode\": \"NOT_FOUND\",\n \"message\": \"The requested resource does not exist\"\n }\n]"
},
{
"name": "Status400-PreviouslyDeletedRecord",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/connect/business-rules/expression-set/:expressionSetId",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"connect",
"business-rules",
"expression-set",
":expressionSetId"
],
"variable": [
{
"key": "expressionSetId",
"value": "9QLHo000000LBjEOAW",
"description": "Expression Set Id: For Example 9QLHo000000LBjEOAW"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 06 Sep 2023 10:29:39 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Robots-Tag",
"value": "none"
},
{
"key": "Cache-Control",
"value": "no-cache,must-revalidate,max-age=0,no-store,private"
},
{
"key": "Content-Type",
"value": "application/json;charset=UTF-8"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "[\n {\n \"errorCode\": \"INVALID_INPUT\",\n \"message\": \"The expression set id is not available.\"\n }\n]"
},
{
"name": "Status400-InvalidIdentifierOfVersion",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/connect/business-rules/expression-set/:expressionSetId",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"connect",
"business-rules",
"expression-set",
":expressionSetId"
],
"variable": [
{
"key": "expressionSetId",
"value": "9QMHo000000LBjOOAW",
"description": "Expression Set Id: For Example 9QLHo000000LBjEOAW"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 06 Sep 2023 10:37:51 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Robots-Tag",
"value": "none"
},
{
"key": "Cache-Control",
"value": "no-cache,must-revalidate,max-age=0,no-store,private"
},
{
"key": "Content-Type",
"value": "application/json;charset=UTF-8"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "[\n {\n \"errorCode\": \"INVALID_ID_FIELD\",\n \"message\": \"Invalid identifier: 9QMHo000000LBjOOAW\"\n }\n]"
}
]
}