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 json;
HCkHttpResponse resp;
HCkStringBuilder sbResponseBody;
HCkJsonObject jResp;
int respStatusCode;
const char *apiName;
const char *eTag;
const char *DisplayValue;
const char *Value;
const char *Active__cDisplayValue;
const char *Active__cValue;
const char *AnnualRevenueDisplayValue;
const char *AnnualRevenueValue;
const char *BillingCityDisplayValue;
const char *BillingCityValue;
const char *BillingCountryDisplayValue;
const char *BillingCountryValue;
const char *BillingPostalCodeDisplayValue;
const char *BillingPostalCodeValue;
const char *BillingStateDisplayValue;
const char *BillingStateValue;
const char *BillingStreetDisplayValue;
const char *BillingStreetValue;
const char *CreatedByDisplayValue;
const char *ApiName;
const char *ETag;
const char *IdDisplayValue;
const char *IdValue;
const char *NameDisplayValue;
const char *NameValue;
const char *Id;
const char *LastModifiedById;
const char *LastModifiedDate;
const char *RecordTypeId;
const char *RecordTypeInfo;
const char *SystemModstamp;
int WeakEtag;
const char *CreatedByIdDisplayValue;
const char *CreatedByIdValue;
const char *CreatedDateDisplayValue;
const char *CreatedDateValue;
const char *CustomerPriority__cDisplayValue;
const char *CustomerPriority__cValue;
const char *DescriptionDisplayValue;
const char *DescriptionValue;
const char *FaxDisplayValue;
const char *FaxValue;
const char *IndustryDisplayValue;
const char *IndustryValue;
const char *LastModifiedByDisplayValue;
const char *ValueApiName;
const char *ValueETag;
const char *ValueId;
const char *ValueLastModifiedById;
const char *ValueLastModifiedDate;
const char *ValueRecordTypeId;
const char *ValueRecordTypeInfo;
const char *ValueSystemModstamp;
int ValueWeakEtag;
const char *LastModifiedByIdDisplayValue;
const char *LastModifiedByIdValue;
const char *LastModifiedDateDisplayValue;
const char *LastModifiedDateValue;
const char *NumberOfEmployeesDisplayValue;
const char *NumberOfEmployeesValue;
const char *NumberofLocations__cDisplayValue;
const char *NumberofLocations__cValue;
const char *OwnerDisplayValue;
const char *OwnerIdDisplayValue;
const char *OwnerIdValue;
const char *OwnershipDisplayValue;
const char *OwnershipValue;
const char *ParentDisplayValue;
const char *ParentValue;
const char *ParentIdDisplayValue;
const char *ParentIdValue;
const char *PhoneDisplayValue;
const char *PhoneValue;
const char *RatingDisplayValue;
const char *RatingValue;
const char *SLAExpirationDate__cDisplayValue;
const char *SLAExpirationDate__cValue;
const char *SLASerialNumber__cDisplayValue;
const char *SLASerialNumber__cValue;
const char *SLA__cDisplayValue;
const char *SLA__cValue;
const char *ShippingCityDisplayValue;
const char *ShippingCityValue;
const char *ShippingCountryDisplayValue;
const char *ShippingCountryValue;
const char *ShippingPostalCodeDisplayValue;
const char *ShippingPostalCodeValue;
const char *ShippingStateDisplayValue;
const char *ShippingStateValue;
const char *ShippingStreetDisplayValue;
const char *ShippingStreetValue;
const char *SicDisplayValue;
const char *SicValue;
const char *SiteDisplayValue;
const char *SiteValue;
const char *TickerSymbolDisplayValue;
const char *TickerSymbolValue;
const char *TypeDisplayValue;
const char *TypeValue;
const char *UpsellOpportunity__cDisplayValue;
const char *UpsellOpportunity__cValue;
const char *WebsiteDisplayValue;
const char *WebsiteValue;
const char *id;
const char *lastModifiedById;
const char *lastModifiedDate;
const char *recordTypeId;
const char *recordTypeInfo;
const char *systemModstamp;
int weakEtag;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttp_Create();
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "allowSaveOnDuplicate": false,
// "apiName": "Object",
// "fields": {
// "FieldAPIName": "FieldValue"
// }
// }
json = CkJsonObject_Create();
CkJsonObject_UpdateBool(json,"allowSaveOnDuplicate",FALSE);
CkJsonObject_UpdateString(json,"apiName","Object");
CkJsonObject_UpdateString(json,"fields.FieldAPIName","FieldValue");
// Adds the "Authorization: Bearer <access_token>" header.
CkHttp_putAuthToken(http,"<access_token>");
CkHttp_SetRequestHeader(http,"Content-Type","application/json");
resp = CkHttp_PostJson3(http,"https://domain.com/services/data/v{{version}}/ui-api/records","application/json",json);
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
CkJsonObject_Dispose(json);
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(json);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
return;
}
CkHttpResponse_Dispose(resp);
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "apiName": "Account",
// "childRelationships": {},
// "eTag": "057ae0953591faed613c5e19a086f7a8",
// "fields": {
// "AccountNumber": {
// "displayValue": null,
// "value": null
// },
// "Active__c": {
// "displayValue": null,
// "value": null
// },
// "AnnualRevenue": {
// "displayValue": null,
// "value": null
// },
// "BillingCity": {
// "displayValue": null,
// "value": null
// },
// "BillingCountry": {
// "displayValue": null,
// "value": null
// },
// "BillingPostalCode": {
// "displayValue": null,
// "value": null
// },
// "BillingState": {
// "displayValue": null,
// "value": null
// },
// "BillingStreet": {
// "displayValue": null,
// "value": null
// },
// "CreatedBy": {
// "displayValue": "Philippe Ozil",
// "value": {
// "apiName": "User",
// "childRelationships": {},
// "eTag": "cc07f7ef1b08ddbd75074c69512dd388",
// "fields": {
// "Id": {
// "displayValue": null,
// "value": "005B0000003TOI6IAO"
// },
// "Name": {
// "displayValue": null,
// "value": "Philippe Ozil"
// }
// },
// "id": "005B0000003TOI6IAO",
// "lastModifiedById": "005B0000003TOI6IAO",
// "lastModifiedDate": "2023-02-02T10:32:12.000Z",
// "recordTypeId": null,
// "recordTypeInfo": null,
// "systemModstamp": "2023-09-27T15:47:51.000Z",
// "weakEtag": 1695829671000
// }
// },
// "CreatedById": {
// "displayValue": null,
// "value": "005B0000003TOI6IAO"
// },
// "CreatedDate": {
// "displayValue": "27/09/2023 18:01",
// "value": "2023-09-27T16:01:14.000Z"
// },
// "CustomerPriority__c": {
// "displayValue": null,
// "value": null
// },
// "Description": {
// "displayValue": null,
// "value": null
// },
// "Fax": {
// "displayValue": null,
// "value": null
// },
// "Industry": {
// "displayValue": null,
// "value": null
// },
// "LastModifiedBy": {
// "displayValue": "Philippe Ozil",
// "value": {
// "apiName": "User",
// "childRelationships": {},
// "eTag": "cc07f7ef1b08ddbd75074c69512dd388",
// "fields": {
// "Id": {
// "displayValue": null,
// "value": "005B0000003TOI6IAO"
// },
// "Name": {
// "displayValue": null,
// "value": "Philippe Ozil"
// }
// },
// "id": "005B0000003TOI6IAO",
// "lastModifiedById": "005B0000003TOI6IAO",
// "lastModifiedDate": "2023-02-02T10:32:12.000Z",
// "recordTypeId": null,
// "recordTypeInfo": null,
// "systemModstamp": "2023-09-27T15:47:51.000Z",
// "weakEtag": 1695829671000
// }
// },
// "LastModifiedById": {
// "displayValue": null,
// "value": "005B0000003TOI6IAO"
// },
// "LastModifiedDate": {
// "displayValue": "27/09/2023 18:01",
// "value": "2023-09-27T16:01:14.000Z"
// },
// "Name": {
// "displayValue": null,
// "value": "My New Account"
// },
// "NumberOfEmployees": {
// "displayValue": null,
// "value": null
// },
// "NumberofLocations__c": {
// "displayValue": null,
// "value": null
// },
// "Owner": {
// "displayValue": "Philippe Ozil",
// "value": {
// "apiName": "User",
// "childRelationships": {},
// "eTag": "cc07f7ef1b08ddbd75074c69512dd388",
// "fields": {
// "Id": {
// "displayValue": null,
// "value": "005B0000003TOI6IAO"
// },
// "Name": {
// "displayValue": null,
// "value": "Philippe Ozil"
// }
// },
// "id": "005B0000003TOI6IAO",
// "lastModifiedById": "005B0000003TOI6IAO",
// "lastModifiedDate": "2023-02-02T10:32:12.000Z",
// "recordTypeId": null,
// "recordTypeInfo": null,
// "systemModstamp": "2023-09-27T15:47:51.000Z",
// "weakEtag": 1695829671000
// }
// },
// "OwnerId": {
// "displayValue": null,
// "value": "005B0000003TOI6IAO"
// },
// "Ownership": {
// "displayValue": null,
// "value": null
// },
// "Parent": {
// "displayValue": null,
// "value": null
// },
// "ParentId": {
// "displayValue": null,
// "value": null
// },
// "Phone": {
// "displayValue": null,
// "value": null
// },
// "Rating": {
// "displayValue": null,
// "value": null
// },
// "SLAExpirationDate__c": {
// "displayValue": null,
// "value": null
// },
// "SLASerialNumber__c": {
// "displayValue": null,
// "value": null
// },
// "SLA__c": {
// "displayValue": null,
// "value": null
// },
// "ShippingCity": {
// "displayValue": null,
// "value": null
// },
// "ShippingCountry": {
// "displayValue": null,
// "value": null
// },
// "ShippingPostalCode": {
// "displayValue": null,
// "value": null
// },
// "ShippingState": {
// "displayValue": null,
// "value": null
// },
// "ShippingStreet": {
// "displayValue": null,
// "value": null
// },
// "Sic": {
// "displayValue": null,
// "value": null
// },
// "Site": {
// "displayValue": null,
// "value": null
// },
// "TickerSymbol": {
// "displayValue": null,
// "value": null
// },
// "Type": {
// "displayValue": null,
// "value": null
// },
// "UpsellOpportunity__c": {
// "displayValue": null,
// "value": null
// },
// "Website": {
// "displayValue": null,
// "value": null
// }
// },
// "id": "0011Q00002Z2P5jQAF",
// "lastModifiedById": "005B0000003TOI6IAO",
// "lastModifiedDate": "2023-09-27T16:01:14.000Z",
// "recordTypeId": "012000000000000AAA",
// "recordTypeInfo": null,
// "systemModstamp": "2023-09-27T16:01:14.000Z",
// "weakEtag": 1695830474000
// }
// 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.
apiName = CkJsonObject_stringOf(jResp,"apiName");
eTag = CkJsonObject_stringOf(jResp,"eTag");
DisplayValue = CkJsonObject_stringOf(jResp,"fields.AccountNumber.displayValue");
Value = CkJsonObject_stringOf(jResp,"fields.AccountNumber.value");
Active__cDisplayValue = CkJsonObject_stringOf(jResp,"fields.Active__c.displayValue");
Active__cValue = CkJsonObject_stringOf(jResp,"fields.Active__c.value");
AnnualRevenueDisplayValue = CkJsonObject_stringOf(jResp,"fields.AnnualRevenue.displayValue");
AnnualRevenueValue = CkJsonObject_stringOf(jResp,"fields.AnnualRevenue.value");
BillingCityDisplayValue = CkJsonObject_stringOf(jResp,"fields.BillingCity.displayValue");
BillingCityValue = CkJsonObject_stringOf(jResp,"fields.BillingCity.value");
BillingCountryDisplayValue = CkJsonObject_stringOf(jResp,"fields.BillingCountry.displayValue");
BillingCountryValue = CkJsonObject_stringOf(jResp,"fields.BillingCountry.value");
BillingPostalCodeDisplayValue = CkJsonObject_stringOf(jResp,"fields.BillingPostalCode.displayValue");
BillingPostalCodeValue = CkJsonObject_stringOf(jResp,"fields.BillingPostalCode.value");
BillingStateDisplayValue = CkJsonObject_stringOf(jResp,"fields.BillingState.displayValue");
BillingStateValue = CkJsonObject_stringOf(jResp,"fields.BillingState.value");
BillingStreetDisplayValue = CkJsonObject_stringOf(jResp,"fields.BillingStreet.displayValue");
BillingStreetValue = CkJsonObject_stringOf(jResp,"fields.BillingStreet.value");
CreatedByDisplayValue = CkJsonObject_stringOf(jResp,"fields.CreatedBy.displayValue");
ApiName = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.apiName");
ETag = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.eTag");
IdDisplayValue = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.fields.Id.displayValue");
IdValue = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.fields.Id.value");
NameDisplayValue = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.fields.Name.displayValue");
NameValue = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.fields.Name.value");
Id = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.id");
LastModifiedById = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.lastModifiedById");
LastModifiedDate = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.lastModifiedDate");
RecordTypeId = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.recordTypeId");
RecordTypeInfo = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.recordTypeInfo");
SystemModstamp = CkJsonObject_stringOf(jResp,"fields.CreatedBy.value.systemModstamp");
WeakEtag = CkJsonObject_IntOf(jResp,"fields.CreatedBy.value.weakEtag");
CreatedByIdDisplayValue = CkJsonObject_stringOf(jResp,"fields.CreatedById.displayValue");
CreatedByIdValue = CkJsonObject_stringOf(jResp,"fields.CreatedById.value");
CreatedDateDisplayValue = CkJsonObject_stringOf(jResp,"fields.CreatedDate.displayValue");
CreatedDateValue = CkJsonObject_stringOf(jResp,"fields.CreatedDate.value");
CustomerPriority__cDisplayValue = CkJsonObject_stringOf(jResp,"fields.CustomerPriority__c.displayValue");
CustomerPriority__cValue = CkJsonObject_stringOf(jResp,"fields.CustomerPriority__c.value");
DescriptionDisplayValue = CkJsonObject_stringOf(jResp,"fields.Description.displayValue");
DescriptionValue = CkJsonObject_stringOf(jResp,"fields.Description.value");
FaxDisplayValue = CkJsonObject_stringOf(jResp,"fields.Fax.displayValue");
FaxValue = CkJsonObject_stringOf(jResp,"fields.Fax.value");
IndustryDisplayValue = CkJsonObject_stringOf(jResp,"fields.Industry.displayValue");
IndustryValue = CkJsonObject_stringOf(jResp,"fields.Industry.value");
LastModifiedByDisplayValue = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.displayValue");
ValueApiName = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.apiName");
ValueETag = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.eTag");
IdDisplayValue = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.fields.Id.displayValue");
IdValue = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.fields.Id.value");
NameDisplayValue = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.fields.Name.displayValue");
NameValue = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.fields.Name.value");
ValueId = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.id");
ValueLastModifiedById = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.lastModifiedById");
ValueLastModifiedDate = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.lastModifiedDate");
ValueRecordTypeId = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.recordTypeId");
ValueRecordTypeInfo = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.recordTypeInfo");
ValueSystemModstamp = CkJsonObject_stringOf(jResp,"fields.LastModifiedBy.value.systemModstamp");
ValueWeakEtag = CkJsonObject_IntOf(jResp,"fields.LastModifiedBy.value.weakEtag");
LastModifiedByIdDisplayValue = CkJsonObject_stringOf(jResp,"fields.LastModifiedById.displayValue");
LastModifiedByIdValue = CkJsonObject_stringOf(jResp,"fields.LastModifiedById.value");
LastModifiedDateDisplayValue = CkJsonObject_stringOf(jResp,"fields.LastModifiedDate.displayValue");
LastModifiedDateValue = CkJsonObject_stringOf(jResp,"fields.LastModifiedDate.value");
NameDisplayValue = CkJsonObject_stringOf(jResp,"fields.Name.displayValue");
NameValue = CkJsonObject_stringOf(jResp,"fields.Name.value");
NumberOfEmployeesDisplayValue = CkJsonObject_stringOf(jResp,"fields.NumberOfEmployees.displayValue");
NumberOfEmployeesValue = CkJsonObject_stringOf(jResp,"fields.NumberOfEmployees.value");
NumberofLocations__cDisplayValue = CkJsonObject_stringOf(jResp,"fields.NumberofLocations__c.displayValue");
NumberofLocations__cValue = CkJsonObject_stringOf(jResp,"fields.NumberofLocations__c.value");
OwnerDisplayValue = CkJsonObject_stringOf(jResp,"fields.Owner.displayValue");
ValueApiName = CkJsonObject_stringOf(jResp,"fields.Owner.value.apiName");
ValueETag = CkJsonObject_stringOf(jResp,"fields.Owner.value.eTag");
IdDisplayValue = CkJsonObject_stringOf(jResp,"fields.Owner.value.fields.Id.displayValue");
IdValue = CkJsonObject_stringOf(jResp,"fields.Owner.value.fields.Id.value");
NameDisplayValue = CkJsonObject_stringOf(jResp,"fields.Owner.value.fields.Name.displayValue");
NameValue = CkJsonObject_stringOf(jResp,"fields.Owner.value.fields.Name.value");
ValueId = CkJsonObject_stringOf(jResp,"fields.Owner.value.id");
ValueLastModifiedById = CkJsonObject_stringOf(jResp,"fields.Owner.value.lastModifiedById");
ValueLastModifiedDate = CkJsonObject_stringOf(jResp,"fields.Owner.value.lastModifiedDate");
ValueRecordTypeId = CkJsonObject_stringOf(jResp,"fields.Owner.value.recordTypeId");
ValueRecordTypeInfo = CkJsonObject_stringOf(jResp,"fields.Owner.value.recordTypeInfo");
ValueSystemModstamp = CkJsonObject_stringOf(jResp,"fields.Owner.value.systemModstamp");
ValueWeakEtag = CkJsonObject_IntOf(jResp,"fields.Owner.value.weakEtag");
OwnerIdDisplayValue = CkJsonObject_stringOf(jResp,"fields.OwnerId.displayValue");
OwnerIdValue = CkJsonObject_stringOf(jResp,"fields.OwnerId.value");
OwnershipDisplayValue = CkJsonObject_stringOf(jResp,"fields.Ownership.displayValue");
OwnershipValue = CkJsonObject_stringOf(jResp,"fields.Ownership.value");
ParentDisplayValue = CkJsonObject_stringOf(jResp,"fields.Parent.displayValue");
ParentValue = CkJsonObject_stringOf(jResp,"fields.Parent.value");
ParentIdDisplayValue = CkJsonObject_stringOf(jResp,"fields.ParentId.displayValue");
ParentIdValue = CkJsonObject_stringOf(jResp,"fields.ParentId.value");
PhoneDisplayValue = CkJsonObject_stringOf(jResp,"fields.Phone.displayValue");
PhoneValue = CkJsonObject_stringOf(jResp,"fields.Phone.value");
RatingDisplayValue = CkJsonObject_stringOf(jResp,"fields.Rating.displayValue");
RatingValue = CkJsonObject_stringOf(jResp,"fields.Rating.value");
SLAExpirationDate__cDisplayValue = CkJsonObject_stringOf(jResp,"fields.SLAExpirationDate__c.displayValue");
SLAExpirationDate__cValue = CkJsonObject_stringOf(jResp,"fields.SLAExpirationDate__c.value");
SLASerialNumber__cDisplayValue = CkJsonObject_stringOf(jResp,"fields.SLASerialNumber__c.displayValue");
SLASerialNumber__cValue = CkJsonObject_stringOf(jResp,"fields.SLASerialNumber__c.value");
SLA__cDisplayValue = CkJsonObject_stringOf(jResp,"fields.SLA__c.displayValue");
SLA__cValue = CkJsonObject_stringOf(jResp,"fields.SLA__c.value");
ShippingCityDisplayValue = CkJsonObject_stringOf(jResp,"fields.ShippingCity.displayValue");
ShippingCityValue = CkJsonObject_stringOf(jResp,"fields.ShippingCity.value");
ShippingCountryDisplayValue = CkJsonObject_stringOf(jResp,"fields.ShippingCountry.displayValue");
ShippingCountryValue = CkJsonObject_stringOf(jResp,"fields.ShippingCountry.value");
ShippingPostalCodeDisplayValue = CkJsonObject_stringOf(jResp,"fields.ShippingPostalCode.displayValue");
ShippingPostalCodeValue = CkJsonObject_stringOf(jResp,"fields.ShippingPostalCode.value");
ShippingStateDisplayValue = CkJsonObject_stringOf(jResp,"fields.ShippingState.displayValue");
ShippingStateValue = CkJsonObject_stringOf(jResp,"fields.ShippingState.value");
ShippingStreetDisplayValue = CkJsonObject_stringOf(jResp,"fields.ShippingStreet.displayValue");
ShippingStreetValue = CkJsonObject_stringOf(jResp,"fields.ShippingStreet.value");
SicDisplayValue = CkJsonObject_stringOf(jResp,"fields.Sic.displayValue");
SicValue = CkJsonObject_stringOf(jResp,"fields.Sic.value");
SiteDisplayValue = CkJsonObject_stringOf(jResp,"fields.Site.displayValue");
SiteValue = CkJsonObject_stringOf(jResp,"fields.Site.value");
TickerSymbolDisplayValue = CkJsonObject_stringOf(jResp,"fields.TickerSymbol.displayValue");
TickerSymbolValue = CkJsonObject_stringOf(jResp,"fields.TickerSymbol.value");
TypeDisplayValue = CkJsonObject_stringOf(jResp,"fields.Type.displayValue");
TypeValue = CkJsonObject_stringOf(jResp,"fields.Type.value");
UpsellOpportunity__cDisplayValue = CkJsonObject_stringOf(jResp,"fields.UpsellOpportunity__c.displayValue");
UpsellOpportunity__cValue = CkJsonObject_stringOf(jResp,"fields.UpsellOpportunity__c.value");
WebsiteDisplayValue = CkJsonObject_stringOf(jResp,"fields.Website.displayValue");
WebsiteValue = CkJsonObject_stringOf(jResp,"fields.Website.value");
id = CkJsonObject_stringOf(jResp,"id");
lastModifiedById = CkJsonObject_stringOf(jResp,"lastModifiedById");
lastModifiedDate = CkJsonObject_stringOf(jResp,"lastModifiedDate");
recordTypeId = CkJsonObject_stringOf(jResp,"recordTypeId");
recordTypeInfo = CkJsonObject_stringOf(jResp,"recordTypeInfo");
systemModstamp = CkJsonObject_stringOf(jResp,"systemModstamp");
weakEtag = CkJsonObject_IntOf(jResp,"weakEtag");
CkHttp_Dispose(http);
CkJsonObject_Dispose(json);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
}
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d '{
"allowSaveOnDuplicate": false,
"apiName": "Object",
"fields": {
"FieldAPIName": "FieldValue"
}
}'
https://domain.com/services/data/v{{version}}/ui-api/records
Postman Collection Item JSON
{
"name": "Create a Record",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"allowSaveOnDuplicate\": false,\n \"apiName\": \"Object\",\n \"fields\": {\n \"FieldAPIName\": \"FieldValue\"\n }\n}"
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/ui-api/records",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"ui-api",
"records"
]
},
"description": "Create a record. First, make a request to the Clone Record Default or Create Record Default resources to get the default metadata and data for the record.\nAs of API version 43.0, if you pass read-only fields in a request body, the response is an Error with Output."
},
"response": [
{
"name": "Create a Record",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"allowSaveOnDuplicate\": false,\n \"apiName\": \"Account\",\n \"fields\": {\n \"Name\": \"My New Account\"\n }\n}"
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/ui-api/records",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"ui-api",
"records"
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 27 Sep 2023 16:01:13 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": "ETag",
"value": "\"057ae0953591faed613c5e19a086f7a8--gzip\""
},
{
"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\": \"Account\",\n \"childRelationships\": {},\n \"eTag\": \"057ae0953591faed613c5e19a086f7a8\",\n \"fields\": {\n \"AccountNumber\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Active__c\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"AnnualRevenue\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"BillingCity\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"BillingCountry\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"BillingPostalCode\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"BillingState\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"BillingStreet\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"CreatedBy\": {\n \"displayValue\": \"Philippe Ozil\",\n \"value\": {\n \"apiName\": \"User\",\n \"childRelationships\": {},\n \"eTag\": \"cc07f7ef1b08ddbd75074c69512dd388\",\n \"fields\": {\n \"Id\": {\n \"displayValue\": null,\n \"value\": \"005B0000003TOI6IAO\"\n },\n \"Name\": {\n \"displayValue\": null,\n \"value\": \"Philippe Ozil\"\n }\n },\n \"id\": \"005B0000003TOI6IAO\",\n \"lastModifiedById\": \"005B0000003TOI6IAO\",\n \"lastModifiedDate\": \"2023-02-02T10:32:12.000Z\",\n \"recordTypeId\": null,\n \"recordTypeInfo\": null,\n \"systemModstamp\": \"2023-09-27T15:47:51.000Z\",\n \"weakEtag\": 1695829671000\n }\n },\n \"CreatedById\": {\n \"displayValue\": null,\n \"value\": \"005B0000003TOI6IAO\"\n },\n \"CreatedDate\": {\n \"displayValue\": \"27/09/2023 18:01\",\n \"value\": \"2023-09-27T16:01:14.000Z\"\n },\n \"CustomerPriority__c\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Description\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Fax\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Industry\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"LastModifiedBy\": {\n \"displayValue\": \"Philippe Ozil\",\n \"value\": {\n \"apiName\": \"User\",\n \"childRelationships\": {},\n \"eTag\": \"cc07f7ef1b08ddbd75074c69512dd388\",\n \"fields\": {\n \"Id\": {\n \"displayValue\": null,\n \"value\": \"005B0000003TOI6IAO\"\n },\n \"Name\": {\n \"displayValue\": null,\n \"value\": \"Philippe Ozil\"\n }\n },\n \"id\": \"005B0000003TOI6IAO\",\n \"lastModifiedById\": \"005B0000003TOI6IAO\",\n \"lastModifiedDate\": \"2023-02-02T10:32:12.000Z\",\n \"recordTypeId\": null,\n \"recordTypeInfo\": null,\n \"systemModstamp\": \"2023-09-27T15:47:51.000Z\",\n \"weakEtag\": 1695829671000\n }\n },\n \"LastModifiedById\": {\n \"displayValue\": null,\n \"value\": \"005B0000003TOI6IAO\"\n },\n \"LastModifiedDate\": {\n \"displayValue\": \"27/09/2023 18:01\",\n \"value\": \"2023-09-27T16:01:14.000Z\"\n },\n \"Name\": {\n \"displayValue\": null,\n \"value\": \"My New Account\"\n },\n \"NumberOfEmployees\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"NumberofLocations__c\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Owner\": {\n \"displayValue\": \"Philippe Ozil\",\n \"value\": {\n \"apiName\": \"User\",\n \"childRelationships\": {},\n \"eTag\": \"cc07f7ef1b08ddbd75074c69512dd388\",\n \"fields\": {\n \"Id\": {\n \"displayValue\": null,\n \"value\": \"005B0000003TOI6IAO\"\n },\n \"Name\": {\n \"displayValue\": null,\n \"value\": \"Philippe Ozil\"\n }\n },\n \"id\": \"005B0000003TOI6IAO\",\n \"lastModifiedById\": \"005B0000003TOI6IAO\",\n \"lastModifiedDate\": \"2023-02-02T10:32:12.000Z\",\n \"recordTypeId\": null,\n \"recordTypeInfo\": null,\n \"systemModstamp\": \"2023-09-27T15:47:51.000Z\",\n \"weakEtag\": 1695829671000\n }\n },\n \"OwnerId\": {\n \"displayValue\": null,\n \"value\": \"005B0000003TOI6IAO\"\n },\n \"Ownership\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Parent\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"ParentId\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Phone\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Rating\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"SLAExpirationDate__c\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"SLASerialNumber__c\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"SLA__c\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"ShippingCity\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"ShippingCountry\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"ShippingPostalCode\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"ShippingState\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"ShippingStreet\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Sic\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Site\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"TickerSymbol\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Type\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"UpsellOpportunity__c\": {\n \"displayValue\": null,\n \"value\": null\n },\n \"Website\": {\n \"displayValue\": null,\n \"value\": null\n }\n },\n \"id\": \"0011Q00002Z2P5jQAF\",\n \"lastModifiedById\": \"005B0000003TOI6IAO\",\n \"lastModifiedDate\": \"2023-09-27T16:01:14.000Z\",\n \"recordTypeId\": \"012000000000000AAA\",\n \"recordTypeInfo\": null,\n \"systemModstamp\": \"2023-09-27T16:01:14.000Z\",\n \"weakEtag\": 1695830474000\n}"
}
]
}