Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_ActivityDate
string ls_JournalSubTypeName
string ls_JournalTypeName
string ls_TransactionJournalId
string ls_TransactionJournalNumber
integer j
integer li_Count_j
string ls_Message
integer li_Status
integer li_TransactionJournalCount
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
li_Success = loo_Http.QuickGetSb("https://domain.com/services/data/v{{version}}/loyalty/programs/:loyaltyProgramName/members/:membershipNumber/transaction-ledger-summary",loo_SbResponseBody)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_SbResponseBody
return
end if
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Http.LastHeader
Write-Debug "Failed."
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "message": null,
// "status": true,
// "transactionJournalCount": 1,
// "transactionJournals": [
// {
// "activityDate": "2021-01-01T04:05:05.000Z",
// "additionalTransactionJournalAttributes": [
// ],
// "journalSubTypeName": "Member Enrollment",
// "journalTypeName": "Accrual",
// "pointsChange": [
// ],
// "transactionJournalId": "0lVJ8000000GmaEMAS",
// "transactionJournalNumber": "00000008"
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
ls_Message = loo_JResp.StringOf("message")
li_Status = loo_JResp.BoolOf("status")
li_TransactionJournalCount = loo_JResp.IntOf("transactionJournalCount")
i = 0
li_Count_i = loo_JResp.SizeOfArray("transactionJournals")
do while i < li_Count_i
loo_JResp.I = i
ls_ActivityDate = loo_JResp.StringOf("transactionJournals[i].activityDate")
ls_JournalSubTypeName = loo_JResp.StringOf("transactionJournals[i].journalSubTypeName")
ls_JournalTypeName = loo_JResp.StringOf("transactionJournals[i].journalTypeName")
ls_TransactionJournalId = loo_JResp.StringOf("transactionJournals[i].transactionJournalId")
ls_TransactionJournalNumber = loo_JResp.StringOf("transactionJournals[i].transactionJournalNumber")
j = 0
li_Count_j = loo_JResp.SizeOfArray("transactionJournals[i].additionalTransactionJournalAttributes")
do while j < li_Count_j
loo_JResp.J = j
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("transactionJournals[i].pointsChange")
do while j < li_Count_j
loo_JResp.J = j
j = j + 1
loop
i = i + 1
loop
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/loyalty/programs/:loyaltyProgramName/members/:membershipNumber/transaction-ledger-summary
Postman Collection Item JSON
{
"name": "Transaction Ledger Summary",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"/*",
"pm.variables.set('journalSubTypeName','journalSubTypeName');",
"pm.variables.set('additionalTransactionJournalAttributes','additionalTransactionJournalAttributes');",
"pm.variables.set('journalTypeName','journalTypeName');",
"pm.variables.set('pageNumber','pageNumber');",
"pm.variables.set('periodEndDate','periodEndDate');",
"pm.variables.set('periodStartDate','periodStartDate');",
"*/"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/loyalty/programs/:loyaltyProgramName/members/:membershipNumber/transaction-ledger-summary",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"loyalty",
"programs",
":loyaltyProgramName",
"members",
":membershipNumber",
"transaction-ledger-summary"
],
"query": [
{
"key": "journalSubTypeName",
"value": "",
"description": "Returns the transaction journals filtered by the specified journal subtype.",
"disabled": true
},
{
"key": "additionalTransactionJournalAttributes",
"value": "",
"description": "Returns the list of transaction journal fields.",
"disabled": true
},
{
"key": "journalTypeName",
"value": "",
"description": "Returns the transaction journals filtered by the specified journal type.",
"disabled": true
},
{
"key": "pageNumber",
"value": "",
"description": "Returns the transaction journals for the specified page number.\n",
"disabled": true
},
{
"key": "periodEndDate",
"value": "",
"description": "Returns the transaction journals filtered by the specified end date.",
"disabled": true
},
{
"key": "periodStartDate",
"value": "",
"description": "Returns the transaction journals filtered by the specified start date.",
"disabled": true
}
],
"variable": [
{
"key": "loyaltyProgramName",
"value": ""
},
{
"key": "membershipNumber",
"value": ""
}
]
},
"description": "Standard Documentation:\n\n[https://developer.salesforce.com/docs/atlas.en-us.loyalty.meta/loyalty/connect_resources_transaction_ledger.htm](https://developer.salesforce.com/docs/atlas.en-us.loyalty.meta/loyalty/connect_resources_transaction_ledger.htm)"
},
"response": [
{
"name": "Transaction Ledger Summary",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/loyalty/programs/:loyaltyProgramName/members/:membershipNumber/transaction-ledger-summary",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"loyalty",
"programs",
":loyaltyProgramName",
"members",
":membershipNumber",
"transaction-ledger-summary"
],
"query": [
{
"key": "journalSubTypeName",
"value": "",
"description": "Returns the transaction journals filtered by the specified journal subtype.",
"disabled": true
},
{
"key": "additionalTransactionJournalAttributes",
"value": "",
"description": "Returns the list of transaction journal fields.",
"disabled": true
},
{
"key": "journalTypeName",
"value": "",
"description": "Returns the transaction journals filtered by the specified journal type.",
"disabled": true
},
{
"key": "pageNumber",
"value": "",
"description": "Returns the transaction journals for the specified page number.\n",
"disabled": true
},
{
"key": "periodEndDate",
"value": "",
"description": "Returns the transaction journals filtered by the specified end date.",
"disabled": true
},
{
"key": "periodStartDate",
"value": "",
"description": "Returns the transaction journals filtered by the specified start date.",
"disabled": true
}
],
"variable": [
{
"key": "loyaltyProgramName",
"value": "NTO Insider"
},
{
"key": "membershipNumber",
"value": "Member123"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Mon, 27 May 2024 19:37:52 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"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 \"message\": null,\n \"status\": true,\n \"transactionJournalCount\": 1,\n \"transactionJournals\": [\n {\n \"activityDate\": \"2021-01-01T04:05:05.000Z\",\n \"additionalTransactionJournalAttributes\": [],\n \"journalSubTypeName\": \"Member Enrollment\",\n \"journalTypeName\": \"Accrual\",\n \"pointsChange\": [],\n \"transactionJournalId\": \"0lVJ8000000GmaEMAS\",\n \"transactionJournalNumber\": \"00000008\"\n }\n ]\n}"
}
]
}