Back to Collection Items
#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>
#include <C_CkStringBuilder.h>
void ChilkatSample(void)
{
HCkHttp http;
BOOL success;
HCkJsonObject queryParams;
HCkHttpResponse resp;
HCkStringBuilder sbResponseBody;
HCkJsonObject jResp;
int respStatusCode;
const char *Level_Before_Reset__c;
int escrowPointsBalance;
int expirablePoints;
const char *lastAccrualProcessedDate;
const char *lastEscrowProcessedDate;
const char *lastExpirationProcessRunDate;
const char *lastPointsAggregationDate;
const char *lastPointsResetDate;
const char *loyaltyMemberCurrencyName;
const char *loyaltyProgramCurrencyId;
const char *loyaltyProgramCurrencyName;
const char *memberCurrencyId;
const char *nextQualifyingPointsResetDate;
int pointsBalance;
int qualifyingPointsBalanceBeforeReset;
int totalEscrowPointsAccrued;
int totalEscrowRolloverPoints;
int totalPointsAccrued;
int totalPointsExpired;
int totalPointsRedeemed;
BOOL areTierBenefitsAssigned;
const char *loyaltyMemberTierId;
const char *loyaltyMemberTierName;
const char *tierChangeReason;
const char *tierChangeReasonType;
const char *tierEffectiveDate;
const char *tierExpirationDate;
const char *tierGroupId;
const char *tierGroupName;
const char *tierId;
int tierSequenceNumber;
const char *associatedAccount;
const char *ContactId;
const char *v_Email;
const char *FirstName;
const char *LastName;
BOOL canReceivePartnerPromotions;
BOOL canReceivePromotions;
const char *enrollmentChannel;
const char *enrollmentDate;
const char *groupCreatedByMember;
const char *groupName;
const char *lastActivityDate;
const char *loyaltyProgramMemberId;
const char *loyaltyProgramName;
const char *memberStatus;
const char *memberType;
const char *membershipEndDate;
const char *membershipLastRenewalDate;
const char *membershipNumber;
const char *referredBy;
const char *relatedCorporateMembershipNumber;
const char *transactionJournalStatementFrequency;
const char *transactionJournalStatementLastGeneratedDate;
const char *transactionJournalStatementMethod;
int i;
int count_i;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttp_Create();
queryParams = CkJsonObject_Create();
CkJsonObject_UpdateString(queryParams,"memberId","");
CkJsonObject_UpdateString(queryParams,"membershipNumber","");
CkJsonObject_UpdateString(queryParams,"programCurrencyName","");
// Adds the "Authorization: Bearer <access_token>" header.
CkHttp_putAuthToken(http,"<access_token>");
resp = CkHttp_QuickRequestParams(http,"GET","https://domain.com/services/data/v{{version}}/loyalty-programs/:loyaltyProgramName/members",queryParams);
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
CkJsonObject_Dispose(queryParams);
return;
}
sbResponseBody = CkStringBuilder_Create();
CkHttpResponse_GetBodySb(resp,sbResponseBody);
jResp = CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,FALSE);
printf("Response Body:\n");
printf("%s\n",CkJsonObject_emit(jResp));
respStatusCode = CkHttpResponse_getStatusCode(resp);
printf("Response Status Code = %d\n",respStatusCode);
if (respStatusCode >= 400) {
printf("Response Header:\n");
printf("%s\n",CkHttpResponse_header(resp));
printf("Failed.\n");
CkHttpResponse_Dispose(resp);
CkHttp_Dispose(http);
CkJsonObject_Dispose(queryParams);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
return;
}
CkHttpResponse_Dispose(resp);
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "additionalLoyaltyProgramMemberFields": {},
// "associatedAccount": null,
// "associatedContact": {
// "contactId": "003J8000002Yu0ZIAS",
// "email": "ab@email.com",
// "firstName": "Name1",
// "lastName": "Name2"
// },
// "canReceivePartnerPromotions": true,
// "canReceivePromotions": true,
// "enrollmentChannel": "Email",
// "enrollmentDate": "2021-01-01",
// "groupCreatedByMember": null,
// "groupName": null,
// "lastActivityDate": null,
// "loyaltyProgramMemberId": "0lMJ8000000CaRMMA0",
// "loyaltyProgramName": "NTO Insider",
// "memberCurrencies": [
// {
// "additionalLoyaltyMemberCurrencyFields": {
// "Level_Before_Reset__c": null
// },
// "escrowPointsBalance": 0,
// "expirablePoints": 0,
// "lastAccrualProcessedDate": null,
// "lastEscrowProcessedDate": null,
// "lastExpirationProcessRunDate": null,
// "lastPointsAggregationDate": null,
// "lastPointsResetDate": null,
// "loyaltyMemberCurrencyName": "NTO Qualifying Points",
// "loyaltyProgramCurrencyId": "0lcJ8000000CaR7IAK",
// "loyaltyProgramCurrencyName": null,
// "memberCurrencyId": "0lzJ8000000CaRMIA0",
// "nextQualifyingPointsResetDate": "2024-12-31",
// "pointsBalance": 0,
// "qualifyingPointsBalanceBeforeReset": 0,
// "totalEscrowPointsAccrued": 0,
// "totalEscrowRolloverPoints": 0,
// "totalPointsAccrued": 0,
// "totalPointsExpired": 0,
// "totalPointsRedeemed": 0
// }
// ],
// "memberStatus": "Active",
// "memberTiers": [
// {
// "additionalLoyaltyMemberTierFields": {},
// "areTierBenefitsAssigned": false,
// "loyaltyMemberTierId": "0lyJ8000000CaRMIA0",
// "loyaltyMemberTierName": "Bronze",
// "tierChangeReason": null,
// "tierChangeReasonType": null,
// "tierEffectiveDate": "2021-01-01",
// "tierExpirationDate": null,
// "tierGroupId": "0ltJ8000000CaR8IAK",
// "tierGroupName": null,
// "tierId": "0lgJ80000008OI5IAM",
// "tierSequenceNumber": 10
// }
// ],
// "memberType": "Individual",
// "membershipEndDate": "2022-01-01",
// "membershipLastRenewalDate": null,
// "membershipNumber": "Member1",
// "referredBy": null,
// "relatedCorporateMembershipNumber": null,
// "transactionJournalStatementFrequency": "Monthly",
// "transactionJournalStatementLastGeneratedDate": null,
// "transactionJournalStatementMethod": "Mail"
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
// Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
associatedAccount = CkJsonObject_stringOf(jResp,"associatedAccount");
ContactId = CkJsonObject_stringOf(jResp,"associatedContact.contactId");
v_Email = CkJsonObject_stringOf(jResp,"associatedContact.email");
FirstName = CkJsonObject_stringOf(jResp,"associatedContact.firstName");
LastName = CkJsonObject_stringOf(jResp,"associatedContact.lastName");
canReceivePartnerPromotions = CkJsonObject_BoolOf(jResp,"canReceivePartnerPromotions");
canReceivePromotions = CkJsonObject_BoolOf(jResp,"canReceivePromotions");
enrollmentChannel = CkJsonObject_stringOf(jResp,"enrollmentChannel");
enrollmentDate = CkJsonObject_stringOf(jResp,"enrollmentDate");
groupCreatedByMember = CkJsonObject_stringOf(jResp,"groupCreatedByMember");
groupName = CkJsonObject_stringOf(jResp,"groupName");
lastActivityDate = CkJsonObject_stringOf(jResp,"lastActivityDate");
loyaltyProgramMemberId = CkJsonObject_stringOf(jResp,"loyaltyProgramMemberId");
loyaltyProgramName = CkJsonObject_stringOf(jResp,"loyaltyProgramName");
memberStatus = CkJsonObject_stringOf(jResp,"memberStatus");
memberType = CkJsonObject_stringOf(jResp,"memberType");
membershipEndDate = CkJsonObject_stringOf(jResp,"membershipEndDate");
membershipLastRenewalDate = CkJsonObject_stringOf(jResp,"membershipLastRenewalDate");
membershipNumber = CkJsonObject_stringOf(jResp,"membershipNumber");
referredBy = CkJsonObject_stringOf(jResp,"referredBy");
relatedCorporateMembershipNumber = CkJsonObject_stringOf(jResp,"relatedCorporateMembershipNumber");
transactionJournalStatementFrequency = CkJsonObject_stringOf(jResp,"transactionJournalStatementFrequency");
transactionJournalStatementLastGeneratedDate = CkJsonObject_stringOf(jResp,"transactionJournalStatementLastGeneratedDate");
transactionJournalStatementMethod = CkJsonObject_stringOf(jResp,"transactionJournalStatementMethod");
i = 0;
count_i = CkJsonObject_SizeOfArray(jResp,"memberCurrencies");
while (i < count_i) {
CkJsonObject_putI(jResp,i);
Level_Before_Reset__c = CkJsonObject_stringOf(jResp,"memberCurrencies[i].additionalLoyaltyMemberCurrencyFields.Level_Before_Reset__c");
escrowPointsBalance = CkJsonObject_IntOf(jResp,"memberCurrencies[i].escrowPointsBalance");
expirablePoints = CkJsonObject_IntOf(jResp,"memberCurrencies[i].expirablePoints");
lastAccrualProcessedDate = CkJsonObject_stringOf(jResp,"memberCurrencies[i].lastAccrualProcessedDate");
lastEscrowProcessedDate = CkJsonObject_stringOf(jResp,"memberCurrencies[i].lastEscrowProcessedDate");
lastExpirationProcessRunDate = CkJsonObject_stringOf(jResp,"memberCurrencies[i].lastExpirationProcessRunDate");
lastPointsAggregationDate = CkJsonObject_stringOf(jResp,"memberCurrencies[i].lastPointsAggregationDate");
lastPointsResetDate = CkJsonObject_stringOf(jResp,"memberCurrencies[i].lastPointsResetDate");
loyaltyMemberCurrencyName = CkJsonObject_stringOf(jResp,"memberCurrencies[i].loyaltyMemberCurrencyName");
loyaltyProgramCurrencyId = CkJsonObject_stringOf(jResp,"memberCurrencies[i].loyaltyProgramCurrencyId");
loyaltyProgramCurrencyName = CkJsonObject_stringOf(jResp,"memberCurrencies[i].loyaltyProgramCurrencyName");
memberCurrencyId = CkJsonObject_stringOf(jResp,"memberCurrencies[i].memberCurrencyId");
nextQualifyingPointsResetDate = CkJsonObject_stringOf(jResp,"memberCurrencies[i].nextQualifyingPointsResetDate");
pointsBalance = CkJsonObject_IntOf(jResp,"memberCurrencies[i].pointsBalance");
qualifyingPointsBalanceBeforeReset = CkJsonObject_IntOf(jResp,"memberCurrencies[i].qualifyingPointsBalanceBeforeReset");
totalEscrowPointsAccrued = CkJsonObject_IntOf(jResp,"memberCurrencies[i].totalEscrowPointsAccrued");
totalEscrowRolloverPoints = CkJsonObject_IntOf(jResp,"memberCurrencies[i].totalEscrowRolloverPoints");
totalPointsAccrued = CkJsonObject_IntOf(jResp,"memberCurrencies[i].totalPointsAccrued");
totalPointsExpired = CkJsonObject_IntOf(jResp,"memberCurrencies[i].totalPointsExpired");
totalPointsRedeemed = CkJsonObject_IntOf(jResp,"memberCurrencies[i].totalPointsRedeemed");
i = i + 1;
}
i = 0;
count_i = CkJsonObject_SizeOfArray(jResp,"memberTiers");
while (i < count_i) {
CkJsonObject_putI(jResp,i);
areTierBenefitsAssigned = CkJsonObject_BoolOf(jResp,"memberTiers[i].areTierBenefitsAssigned");
loyaltyMemberTierId = CkJsonObject_stringOf(jResp,"memberTiers[i].loyaltyMemberTierId");
loyaltyMemberTierName = CkJsonObject_stringOf(jResp,"memberTiers[i].loyaltyMemberTierName");
tierChangeReason = CkJsonObject_stringOf(jResp,"memberTiers[i].tierChangeReason");
tierChangeReasonType = CkJsonObject_stringOf(jResp,"memberTiers[i].tierChangeReasonType");
tierEffectiveDate = CkJsonObject_stringOf(jResp,"memberTiers[i].tierEffectiveDate");
tierExpirationDate = CkJsonObject_stringOf(jResp,"memberTiers[i].tierExpirationDate");
tierGroupId = CkJsonObject_stringOf(jResp,"memberTiers[i].tierGroupId");
tierGroupName = CkJsonObject_stringOf(jResp,"memberTiers[i].tierGroupName");
tierId = CkJsonObject_stringOf(jResp,"memberTiers[i].tierId");
tierSequenceNumber = CkJsonObject_IntOf(jResp,"memberTiers[i].tierSequenceNumber");
i = i + 1;
}
CkHttp_Dispose(http);
CkJsonObject_Dispose(queryParams);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
}
Curl Command
curl -G -d "memberId="
-d "membershipNumber="
-d "programCurrencyName="
-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/loyalty-programs/:loyaltyProgramName/members
Postman Collection Item JSON
{
"name": "Member Profile",
"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?memberId=&membershipNumber=&programCurrencyName=",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"loyalty-programs",
":loyaltyProgramName",
"members"
],
"query": [
{
"key": "memberId",
"value": "",
"description": "The ID of the loyalty program member."
},
{
"key": "membershipNumber",
"value": "",
"description": "The membership number of the loyalty program member."
},
{
"key": "programCurrencyName",
"value": "",
"description": "The name of the loyalty program currency associated with the member.\nUse this parameter to get the details of the member’s points-related information for a specific currency."
}
],
"variable": [
{
"key": "loyaltyProgramName",
"value": ""
}
]
},
"description": "Standard Documentation:\n\n[https://developer.salesforce.com/docs/atlas.en-us.loyalty.meta/loyalty/connect_resources_member_profile.htm](https://developer.salesforce.com/docs/atlas.en-us.loyalty.meta/loyalty/connect_resources_member_profile.htm)"
},
"response": [
{
"name": "Member Profile",
"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?memberId=0lMJ8000000CaRMMA0&membershipNumber=Member1&programCurrencyName=NTO Qualifying Points",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"loyalty-programs",
":loyaltyProgramName",
"members"
],
"query": [
{
"key": "memberId",
"value": "0lMJ8000000CaRMMA0",
"description": "The ID of the loyalty program member."
},
{
"key": "membershipNumber",
"value": "Member1",
"description": "The membership number of the loyalty program member."
},
{
"key": "programCurrencyName",
"value": "NTO Qualifying Points",
"description": "The name of the loyalty program currency associated with the member.\nUse this parameter to get the details of the member’s points-related information for a specific currency."
}
],
"variable": [
{
"key": "loyaltyProgramName",
"value": "NTO Insider"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 22 May 2024 16:16:23 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 \"additionalLoyaltyProgramMemberFields\": {},\n \"associatedAccount\": null,\n \"associatedContact\": {\n \"contactId\": \"003J8000002Yu0ZIAS\",\n \"email\": \"ab@email.com\",\n \"firstName\": \"Name1\",\n \"lastName\": \"Name2\"\n },\n \"canReceivePartnerPromotions\": true,\n \"canReceivePromotions\": true,\n \"enrollmentChannel\": \"Email\",\n \"enrollmentDate\": \"2021-01-01\",\n \"groupCreatedByMember\": null,\n \"groupName\": null,\n \"lastActivityDate\": null,\n \"loyaltyProgramMemberId\": \"0lMJ8000000CaRMMA0\",\n \"loyaltyProgramName\": \"NTO Insider\",\n \"memberCurrencies\": [\n {\n \"additionalLoyaltyMemberCurrencyFields\": {\n \"Level_Before_Reset__c\": null\n },\n \"escrowPointsBalance\": 0,\n \"expirablePoints\": 0,\n \"lastAccrualProcessedDate\": null,\n \"lastEscrowProcessedDate\": null,\n \"lastExpirationProcessRunDate\": null,\n \"lastPointsAggregationDate\": null,\n \"lastPointsResetDate\": null,\n \"loyaltyMemberCurrencyName\": \"NTO Qualifying Points\",\n \"loyaltyProgramCurrencyId\": \"0lcJ8000000CaR7IAK\",\n \"loyaltyProgramCurrencyName\": null,\n \"memberCurrencyId\": \"0lzJ8000000CaRMIA0\",\n \"nextQualifyingPointsResetDate\": \"2024-12-31\",\n \"pointsBalance\": 0,\n \"qualifyingPointsBalanceBeforeReset\": 0,\n \"totalEscrowPointsAccrued\": 0,\n \"totalEscrowRolloverPoints\": 0,\n \"totalPointsAccrued\": 0,\n \"totalPointsExpired\": 0,\n \"totalPointsRedeemed\": 0\n }\n ],\n \"memberStatus\": \"Active\",\n \"memberTiers\": [\n {\n \"additionalLoyaltyMemberTierFields\": {},\n \"areTierBenefitsAssigned\": false,\n \"loyaltyMemberTierId\": \"0lyJ8000000CaRMIA0\",\n \"loyaltyMemberTierName\": \"Bronze\",\n \"tierChangeReason\": null,\n \"tierChangeReasonType\": null,\n \"tierEffectiveDate\": \"2021-01-01\",\n \"tierExpirationDate\": null,\n \"tierGroupId\": \"0ltJ8000000CaR8IAK\",\n \"tierGroupName\": null,\n \"tierId\": \"0lgJ80000008OI5IAM\",\n \"tierSequenceNumber\": 10\n }\n ],\n \"memberType\": \"Individual\",\n \"membershipEndDate\": \"2022-01-01\",\n \"membershipLastRenewalDate\": null,\n \"membershipNumber\": \"Member1\",\n \"referredBy\": null,\n \"relatedCorporateMembershipNumber\": null,\n \"transactionJournalStatementFrequency\": \"Monthly\",\n \"transactionJournalStatementLastGeneratedDate\": null,\n \"transactionJournalStatementMethod\": \"Mail\"\n}"
}
]
}