Back to Collection Items
#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>
#include <C_CkStringBuilderW.h>
void ChilkatSample(void)
{
HCkHttpW http;
BOOL success;
HCkJsonObjectW json;
HCkHttpResponseW resp;
HCkStringBuilderW sbResponseBody;
HCkJsonObjectW jResp;
int respStatusCode;
const wchar_t *apiName;
const wchar_t *eTag;
const wchar_t *DisplayValue;
const wchar_t *Value;
const wchar_t *Active__cDisplayValue;
const wchar_t *Active__cValue;
const wchar_t *AnnualRevenueDisplayValue;
const wchar_t *AnnualRevenueValue;
const wchar_t *BillingCityDisplayValue;
const wchar_t *BillingCityValue;
const wchar_t *BillingCountryDisplayValue;
const wchar_t *BillingCountryValue;
const wchar_t *BillingPostalCodeDisplayValue;
const wchar_t *BillingPostalCodeValue;
const wchar_t *BillingStateDisplayValue;
const wchar_t *BillingStateValue;
const wchar_t *BillingStreetDisplayValue;
const wchar_t *BillingStreetValue;
const wchar_t *CreatedByDisplayValue;
const wchar_t *ApiName;
const wchar_t *ETag;
const wchar_t *IdDisplayValue;
const wchar_t *IdValue;
const wchar_t *NameDisplayValue;
const wchar_t *NameValue;
const wchar_t *Id;
const wchar_t *LastModifiedById;
const wchar_t *LastModifiedDate;
const wchar_t *RecordTypeId;
const wchar_t *RecordTypeInfo;
const wchar_t *SystemModstamp;
int WeakEtag;
const wchar_t *CreatedByIdDisplayValue;
const wchar_t *CreatedByIdValue;
const wchar_t *CreatedDateDisplayValue;
const wchar_t *CreatedDateValue;
const wchar_t *CustomerPriority__cDisplayValue;
const wchar_t *CustomerPriority__cValue;
const wchar_t *DescriptionDisplayValue;
const wchar_t *DescriptionValue;
const wchar_t *FaxDisplayValue;
const wchar_t *FaxValue;
const wchar_t *IndustryDisplayValue;
const wchar_t *IndustryValue;
const wchar_t *LastModifiedByDisplayValue;
const wchar_t *ValueApiName;
const wchar_t *ValueETag;
const wchar_t *ValueId;
const wchar_t *ValueLastModifiedById;
const wchar_t *ValueLastModifiedDate;
const wchar_t *ValueRecordTypeId;
const wchar_t *ValueRecordTypeInfo;
const wchar_t *ValueSystemModstamp;
int ValueWeakEtag;
const wchar_t *LastModifiedByIdDisplayValue;
const wchar_t *LastModifiedByIdValue;
const wchar_t *LastModifiedDateDisplayValue;
const wchar_t *LastModifiedDateValue;
const wchar_t *NumberOfEmployeesDisplayValue;
const wchar_t *NumberOfEmployeesValue;
const wchar_t *NumberofLocations__cDisplayValue;
const wchar_t *NumberofLocations__cValue;
const wchar_t *OwnerDisplayValue;
const wchar_t *OwnerIdDisplayValue;
const wchar_t *OwnerIdValue;
const wchar_t *OwnershipDisplayValue;
const wchar_t *OwnershipValue;
const wchar_t *ParentDisplayValue;
const wchar_t *ParentValue;
const wchar_t *ParentIdDisplayValue;
const wchar_t *ParentIdValue;
const wchar_t *PhoneDisplayValue;
const wchar_t *PhoneValue;
const wchar_t *RatingDisplayValue;
const wchar_t *RatingValue;
const wchar_t *SLAExpirationDate__cDisplayValue;
const wchar_t *SLAExpirationDate__cValue;
const wchar_t *SLASerialNumber__cDisplayValue;
const wchar_t *SLASerialNumber__cValue;
const wchar_t *SLA__cDisplayValue;
const wchar_t *SLA__cValue;
const wchar_t *ShippingCityDisplayValue;
const wchar_t *ShippingCityValue;
const wchar_t *ShippingCountryDisplayValue;
const wchar_t *ShippingCountryValue;
const wchar_t *ShippingPostalCodeDisplayValue;
const wchar_t *ShippingPostalCodeValue;
const wchar_t *ShippingStateDisplayValue;
const wchar_t *ShippingStateValue;
const wchar_t *ShippingStreetDisplayValue;
const wchar_t *ShippingStreetValue;
const wchar_t *SicDisplayValue;
const wchar_t *SicValue;
const wchar_t *SiteDisplayValue;
const wchar_t *SiteValue;
const wchar_t *TickerSymbolDisplayValue;
const wchar_t *TickerSymbolValue;
const wchar_t *TypeDisplayValue;
const wchar_t *TypeValue;
const wchar_t *UpsellOpportunity__cDisplayValue;
const wchar_t *UpsellOpportunity__cValue;
const wchar_t *WebsiteDisplayValue;
const wchar_t *WebsiteValue;
const wchar_t *id;
const wchar_t *lastModifiedById;
const wchar_t *lastModifiedDate;
const wchar_t *recordTypeId;
const wchar_t *recordTypeInfo;
const wchar_t *systemModstamp;
int weakEtag;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_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 = CkJsonObjectW_Create();
CkJsonObjectW_UpdateBool(json,L"allowSaveOnDuplicate",FALSE);
CkJsonObjectW_UpdateString(json,L"apiName",L"Object");
CkJsonObjectW_UpdateString(json,L"fields.FieldAPIName",L"FieldValue");
// Adds the "Authorization: Bearer <access_token>" header.
CkHttpW_putAuthToken(http,L"<access_token>");
CkHttpW_SetRequestHeader(http,L"Content-Type",L"application/json");
resp = CkHttpW_PostJson3(http,L"https://domain.com/services/data/v{{version}}/ui-api/records",L"application/json",json);
if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
return;
}
sbResponseBody = CkStringBuilderW_Create();
CkHttpResponseW_GetBodySb(resp,sbResponseBody);
jResp = CkJsonObjectW_Create();
CkJsonObjectW_LoadSb(jResp,sbResponseBody);
CkJsonObjectW_putEmitCompact(jResp,FALSE);
wprintf(L"Response Body:\n");
wprintf(L"%s\n",CkJsonObjectW_emit(jResp));
respStatusCode = CkHttpResponseW_getStatusCode(resp);
wprintf(L"Response Status Code = %d\n",respStatusCode);
if (respStatusCode >= 400) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkHttpResponseW_header(resp));
wprintf(L"Failed.\n");
CkHttpResponseW_Dispose(resp);
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jResp);
return;
}
CkHttpResponseW_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 = CkJsonObjectW_stringOf(jResp,L"apiName");
eTag = CkJsonObjectW_stringOf(jResp,L"eTag");
DisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.AccountNumber.displayValue");
Value = CkJsonObjectW_stringOf(jResp,L"fields.AccountNumber.value");
Active__cDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Active__c.displayValue");
Active__cValue = CkJsonObjectW_stringOf(jResp,L"fields.Active__c.value");
AnnualRevenueDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.AnnualRevenue.displayValue");
AnnualRevenueValue = CkJsonObjectW_stringOf(jResp,L"fields.AnnualRevenue.value");
BillingCityDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.BillingCity.displayValue");
BillingCityValue = CkJsonObjectW_stringOf(jResp,L"fields.BillingCity.value");
BillingCountryDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.BillingCountry.displayValue");
BillingCountryValue = CkJsonObjectW_stringOf(jResp,L"fields.BillingCountry.value");
BillingPostalCodeDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.BillingPostalCode.displayValue");
BillingPostalCodeValue = CkJsonObjectW_stringOf(jResp,L"fields.BillingPostalCode.value");
BillingStateDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.BillingState.displayValue");
BillingStateValue = CkJsonObjectW_stringOf(jResp,L"fields.BillingState.value");
BillingStreetDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.BillingStreet.displayValue");
BillingStreetValue = CkJsonObjectW_stringOf(jResp,L"fields.BillingStreet.value");
CreatedByDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.displayValue");
ApiName = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.apiName");
ETag = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.eTag");
IdDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.fields.Id.displayValue");
IdValue = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.fields.Id.value");
NameDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.fields.Name.displayValue");
NameValue = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.fields.Name.value");
Id = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.id");
LastModifiedById = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.lastModifiedById");
LastModifiedDate = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.lastModifiedDate");
RecordTypeId = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.recordTypeId");
RecordTypeInfo = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.recordTypeInfo");
SystemModstamp = CkJsonObjectW_stringOf(jResp,L"fields.CreatedBy.value.systemModstamp");
WeakEtag = CkJsonObjectW_IntOf(jResp,L"fields.CreatedBy.value.weakEtag");
CreatedByIdDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.CreatedById.displayValue");
CreatedByIdValue = CkJsonObjectW_stringOf(jResp,L"fields.CreatedById.value");
CreatedDateDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.CreatedDate.displayValue");
CreatedDateValue = CkJsonObjectW_stringOf(jResp,L"fields.CreatedDate.value");
CustomerPriority__cDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.CustomerPriority__c.displayValue");
CustomerPriority__cValue = CkJsonObjectW_stringOf(jResp,L"fields.CustomerPriority__c.value");
DescriptionDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Description.displayValue");
DescriptionValue = CkJsonObjectW_stringOf(jResp,L"fields.Description.value");
FaxDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Fax.displayValue");
FaxValue = CkJsonObjectW_stringOf(jResp,L"fields.Fax.value");
IndustryDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Industry.displayValue");
IndustryValue = CkJsonObjectW_stringOf(jResp,L"fields.Industry.value");
LastModifiedByDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.displayValue");
ValueApiName = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.apiName");
ValueETag = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.eTag");
IdDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.fields.Id.displayValue");
IdValue = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.fields.Id.value");
NameDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.fields.Name.displayValue");
NameValue = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.fields.Name.value");
ValueId = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.id");
ValueLastModifiedById = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.lastModifiedById");
ValueLastModifiedDate = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.lastModifiedDate");
ValueRecordTypeId = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.recordTypeId");
ValueRecordTypeInfo = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.recordTypeInfo");
ValueSystemModstamp = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedBy.value.systemModstamp");
ValueWeakEtag = CkJsonObjectW_IntOf(jResp,L"fields.LastModifiedBy.value.weakEtag");
LastModifiedByIdDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedById.displayValue");
LastModifiedByIdValue = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedById.value");
LastModifiedDateDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedDate.displayValue");
LastModifiedDateValue = CkJsonObjectW_stringOf(jResp,L"fields.LastModifiedDate.value");
NameDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Name.displayValue");
NameValue = CkJsonObjectW_stringOf(jResp,L"fields.Name.value");
NumberOfEmployeesDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.NumberOfEmployees.displayValue");
NumberOfEmployeesValue = CkJsonObjectW_stringOf(jResp,L"fields.NumberOfEmployees.value");
NumberofLocations__cDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.NumberofLocations__c.displayValue");
NumberofLocations__cValue = CkJsonObjectW_stringOf(jResp,L"fields.NumberofLocations__c.value");
OwnerDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Owner.displayValue");
ValueApiName = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.apiName");
ValueETag = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.eTag");
IdDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.fields.Id.displayValue");
IdValue = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.fields.Id.value");
NameDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.fields.Name.displayValue");
NameValue = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.fields.Name.value");
ValueId = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.id");
ValueLastModifiedById = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.lastModifiedById");
ValueLastModifiedDate = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.lastModifiedDate");
ValueRecordTypeId = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.recordTypeId");
ValueRecordTypeInfo = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.recordTypeInfo");
ValueSystemModstamp = CkJsonObjectW_stringOf(jResp,L"fields.Owner.value.systemModstamp");
ValueWeakEtag = CkJsonObjectW_IntOf(jResp,L"fields.Owner.value.weakEtag");
OwnerIdDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.OwnerId.displayValue");
OwnerIdValue = CkJsonObjectW_stringOf(jResp,L"fields.OwnerId.value");
OwnershipDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Ownership.displayValue");
OwnershipValue = CkJsonObjectW_stringOf(jResp,L"fields.Ownership.value");
ParentDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Parent.displayValue");
ParentValue = CkJsonObjectW_stringOf(jResp,L"fields.Parent.value");
ParentIdDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.ParentId.displayValue");
ParentIdValue = CkJsonObjectW_stringOf(jResp,L"fields.ParentId.value");
PhoneDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Phone.displayValue");
PhoneValue = CkJsonObjectW_stringOf(jResp,L"fields.Phone.value");
RatingDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Rating.displayValue");
RatingValue = CkJsonObjectW_stringOf(jResp,L"fields.Rating.value");
SLAExpirationDate__cDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.SLAExpirationDate__c.displayValue");
SLAExpirationDate__cValue = CkJsonObjectW_stringOf(jResp,L"fields.SLAExpirationDate__c.value");
SLASerialNumber__cDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.SLASerialNumber__c.displayValue");
SLASerialNumber__cValue = CkJsonObjectW_stringOf(jResp,L"fields.SLASerialNumber__c.value");
SLA__cDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.SLA__c.displayValue");
SLA__cValue = CkJsonObjectW_stringOf(jResp,L"fields.SLA__c.value");
ShippingCityDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.ShippingCity.displayValue");
ShippingCityValue = CkJsonObjectW_stringOf(jResp,L"fields.ShippingCity.value");
ShippingCountryDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.ShippingCountry.displayValue");
ShippingCountryValue = CkJsonObjectW_stringOf(jResp,L"fields.ShippingCountry.value");
ShippingPostalCodeDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.ShippingPostalCode.displayValue");
ShippingPostalCodeValue = CkJsonObjectW_stringOf(jResp,L"fields.ShippingPostalCode.value");
ShippingStateDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.ShippingState.displayValue");
ShippingStateValue = CkJsonObjectW_stringOf(jResp,L"fields.ShippingState.value");
ShippingStreetDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.ShippingStreet.displayValue");
ShippingStreetValue = CkJsonObjectW_stringOf(jResp,L"fields.ShippingStreet.value");
SicDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Sic.displayValue");
SicValue = CkJsonObjectW_stringOf(jResp,L"fields.Sic.value");
SiteDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Site.displayValue");
SiteValue = CkJsonObjectW_stringOf(jResp,L"fields.Site.value");
TickerSymbolDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.TickerSymbol.displayValue");
TickerSymbolValue = CkJsonObjectW_stringOf(jResp,L"fields.TickerSymbol.value");
TypeDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Type.displayValue");
TypeValue = CkJsonObjectW_stringOf(jResp,L"fields.Type.value");
UpsellOpportunity__cDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.UpsellOpportunity__c.displayValue");
UpsellOpportunity__cValue = CkJsonObjectW_stringOf(jResp,L"fields.UpsellOpportunity__c.value");
WebsiteDisplayValue = CkJsonObjectW_stringOf(jResp,L"fields.Website.displayValue");
WebsiteValue = CkJsonObjectW_stringOf(jResp,L"fields.Website.value");
id = CkJsonObjectW_stringOf(jResp,L"id");
lastModifiedById = CkJsonObjectW_stringOf(jResp,L"lastModifiedById");
lastModifiedDate = CkJsonObjectW_stringOf(jResp,L"lastModifiedDate");
recordTypeId = CkJsonObjectW_stringOf(jResp,L"recordTypeId");
recordTypeInfo = CkJsonObjectW_stringOf(jResp,L"recordTypeInfo");
systemModstamp = CkJsonObjectW_stringOf(jResp,L"systemModstamp");
weakEtag = CkJsonObjectW_IntOf(jResp,L"weakEtag");
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_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}"
}
]
}