Returns the entire JSON record for a specific incident.
curl -X GET https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/incidents \
-H "Accept: application/json" \
-H "OData-MaxVersion: 4.0" \
-H "OData-Version: 4.0" \
-d "$expand=customerid_account($select=accountid,name)" \
-d "$filter=incidentid eq c49e62a8-90df-e311-9565-a45d36fc5fe8" \
-H "Authorization: Bearer DYNAMICS_CRM_ACCESS_TOKEN"
var
rest: HCkRest;
success: Boolean;
bTls: Boolean;
port: Integer;
bAutoReconnect: Boolean;
sbResponseBody: HCkStringBuilder;
respStatusCode: Integer;
jsonResponse: HCkJsonObject;
i: Integer;
count_i: Integer;
odataContext: PWideChar;
odataEtag: PWideChar;
v_resolvebykpiid_value: PWideChar;
customercontacted: Boolean;
v_accountid_value: PWideChar;
prioritycode: Integer;
v_msdyn_incidenttype_value: PWideChar;
caseorigincode: Integer;
modifiedon: PWideChar;
v_parentcaseid_value: PWideChar;
v_slainvokedid_value: PWideChar;
overriddencreatedon: PWideChar;
isescalated: Boolean;
int_paraturecasenumber: PWideChar;
checkemail: Boolean;
followupby: PWideChar;
ticketnumber: PWideChar;
versionnumber: Integer;
v_modifiedby_value: PWideChar;
billedserviceunits: PWideChar;
decremententitlementterm: Boolean;
onholdtime: PWideChar;
resolveby: PWideChar;
int_upsellreferral: Boolean;
messagetypecode: PWideChar;
emailaddress: PWideChar;
merged: Boolean;
int_surveryparticipation: PWideChar;
contractservicelevelcode: PWideChar;
v_createdonbehalfby_value: PWideChar;
v_contactid_value: PWideChar;
v_existingcase_value: PWideChar;
productserialnumber: PWideChar;
v_owninguser_value: PWideChar;
int_effortnum: PWideChar;
escalatedon: PWideChar;
v_productid_value: PWideChar;
followuptaskcreated: Boolean;
v_ownerid_value: PWideChar;
new_actualsatisfaction: PWideChar;
v_socialprofileid_value: PWideChar;
v_createdbyexternalparty_value: PWideChar;
v_contractid_value: PWideChar;
v_modifiedbyexternalparty_value: PWideChar;
v_masterid_value: PWideChar;
timezoneruleversionnumber: Integer;
entityimageid: PWideChar;
v_primarycontactid_value: PWideChar;
importsequencenumber: Integer;
v_owningteam_value: PWideChar;
routecase: Boolean;
blockedprofile: Boolean;
statecode: Integer;
int_casecategory: PWideChar;
entityimage_timestamp: PWideChar;
firstresponseslastatus: Integer;
traversedpath: PWideChar;
int_actualsatisfaction: PWideChar;
v_int_associatedproduct_value: PWideChar;
v_customerid_value: PWideChar;
entityimage: PWideChar;
v_entitlementid_value: PWideChar;
activitiescomplete: Boolean;
new_upsellreferral: PWideChar;
statuscode: Integer;
processid: PWideChar;
v_contractdetailid_value: PWideChar;
int_customereffort: Integer;
responseby: PWideChar;
v_transactioncurrencyid_value: PWideChar;
sentimentvalue: PWideChar;
v_slaid_value: PWideChar;
influencescore: PWideChar;
v_firstresponsebykpiid_value: PWideChar;
utcconversiontimezonecode: PWideChar;
numberofchildincidents: PWideChar;
incidentid: PWideChar;
new_casecategory: PWideChar;
v_owningbusinessunit_value: PWideChar;
casetypecode: Integer;
resolvebyslastatus: Integer;
createdon: PWideChar;
severitycode: Integer;
exchangerate: PWideChar;
v_subjectid_value: PWideChar;
servicestage: Integer;
description: PWideChar;
lastonholdtime: PWideChar;
actualserviceunits: PWideChar;
title: PWideChar;
v_createdby_value: PWideChar;
isdecrementing: Boolean;
v_modifiedonbehalfby_value: PWideChar;
customersatisfactioncode: Integer;
stageid: PWideChar;
v_kbarticleid_value: PWideChar;
entityimage_url: PWideChar;
firstresponsesent: Boolean;
incidentstagecode: Integer;
customerid_accountAccountid: PWideChar;
customerid_accountName: PWideChar;
begin
rest := CkRest_Create();
// URL: https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/incidents
bTls := True;
port := 443;
bAutoReconnect := True;
success := CkRest_Connect(rest,'my-dynamics-domain.api.crm.dynamics.com',port,bTls,bAutoReconnect);
if (success <> True) then
begin
Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(CkRest_getConnectFailReason(rest)));
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
CkRest_AddQueryParam(rest,'$expand','customerid_account($select=accountid,name)');
CkRest_AddQueryParam(rest,'$filter','incidentid eq c49e62a8-90df-e311-9565-a45d36fc5fe8');
CkRest_AddHeader(rest,'OData-MaxVersion','4.0');
CkRest_AddHeader(rest,'Accept','application/json');
CkRest_AddHeader(rest,'OData-Version','4.0');
CkRest_AddHeader(rest,'Authorization','Bearer DYNAMICS_CRM_ACCESS_TOKEN');
sbResponseBody := CkStringBuilder_Create();
success := CkRest_FullRequestNoBodySb(rest,'GET','/api/data/v9.0/incidents',sbResponseBody);
if (success <> True) then
begin
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
respStatusCode := CkRest_getResponseStatusCode(rest);
if (respStatusCode >= 400) then
begin
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
Memo1.Lines.Add('Response Header:');
Memo1.Lines.Add(CkRest__responseHeader(rest));
Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkStringBuilder__getAsString(sbResponseBody));
Exit;
end;
jsonResponse := CkJsonObject_Create();
CkJsonObject_LoadSb(jsonResponse,sbResponseBody);
odataContext := CkJsonObject__stringOf(jsonResponse,'"@odata.context"');
i := 0;
count_i := CkJsonObject_SizeOfArray(jsonResponse,'value');
while i < count_i do
begin
CkJsonObject_putI(jsonResponse,i);
odataEtag := CkJsonObject__stringOf(jsonResponse,'value[i]."@odata.etag"');
v_resolvebykpiid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._resolvebykpiid_value');
customercontacted := CkJsonObject_BoolOf(jsonResponse,'value[i].customercontacted');
v_accountid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._accountid_value');
prioritycode := CkJsonObject_IntOf(jsonResponse,'value[i].prioritycode');
v_msdyn_incidenttype_value := CkJsonObject__stringOf(jsonResponse,'value[i]._msdyn_incidenttype_value');
caseorigincode := CkJsonObject_IntOf(jsonResponse,'value[i].caseorigincode');
modifiedon := CkJsonObject__stringOf(jsonResponse,'value[i].modifiedon');
v_parentcaseid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._parentcaseid_value');
v_slainvokedid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._slainvokedid_value');
overriddencreatedon := CkJsonObject__stringOf(jsonResponse,'value[i].overriddencreatedon');
isescalated := CkJsonObject_BoolOf(jsonResponse,'value[i].isescalated');
int_paraturecasenumber := CkJsonObject__stringOf(jsonResponse,'value[i].int_paraturecasenumber');
checkemail := CkJsonObject_BoolOf(jsonResponse,'value[i].checkemail');
followupby := CkJsonObject__stringOf(jsonResponse,'value[i].followupby');
ticketnumber := CkJsonObject__stringOf(jsonResponse,'value[i].ticketnumber');
versionnumber := CkJsonObject_IntOf(jsonResponse,'value[i].versionnumber');
v_modifiedby_value := CkJsonObject__stringOf(jsonResponse,'value[i]._modifiedby_value');
billedserviceunits := CkJsonObject__stringOf(jsonResponse,'value[i].billedserviceunits');
decremententitlementterm := CkJsonObject_BoolOf(jsonResponse,'value[i].decremententitlementterm');
onholdtime := CkJsonObject__stringOf(jsonResponse,'value[i].onholdtime');
resolveby := CkJsonObject__stringOf(jsonResponse,'value[i].resolveby');
int_upsellreferral := CkJsonObject_BoolOf(jsonResponse,'value[i].int_upsellreferral');
messagetypecode := CkJsonObject__stringOf(jsonResponse,'value[i].messagetypecode');
emailaddress := CkJsonObject__stringOf(jsonResponse,'value[i].emailaddress');
merged := CkJsonObject_BoolOf(jsonResponse,'value[i].merged');
int_surveryparticipation := CkJsonObject__stringOf(jsonResponse,'value[i].int_surveryparticipation');
contractservicelevelcode := CkJsonObject__stringOf(jsonResponse,'value[i].contractservicelevelcode');
v_createdonbehalfby_value := CkJsonObject__stringOf(jsonResponse,'value[i]._createdonbehalfby_value');
v_contactid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._contactid_value');
v_existingcase_value := CkJsonObject__stringOf(jsonResponse,'value[i]._existingcase_value');
productserialnumber := CkJsonObject__stringOf(jsonResponse,'value[i].productserialnumber');
v_owninguser_value := CkJsonObject__stringOf(jsonResponse,'value[i]._owninguser_value');
int_effortnum := CkJsonObject__stringOf(jsonResponse,'value[i].int_effortnum');
escalatedon := CkJsonObject__stringOf(jsonResponse,'value[i].escalatedon');
v_productid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._productid_value');
followuptaskcreated := CkJsonObject_BoolOf(jsonResponse,'value[i].followuptaskcreated');
v_ownerid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._ownerid_value');
new_actualsatisfaction := CkJsonObject__stringOf(jsonResponse,'value[i].new_actualsatisfaction');
v_socialprofileid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._socialprofileid_value');
v_createdbyexternalparty_value := CkJsonObject__stringOf(jsonResponse,'value[i]._createdbyexternalparty_value');
v_contractid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._contractid_value');
v_modifiedbyexternalparty_value := CkJsonObject__stringOf(jsonResponse,'value[i]._modifiedbyexternalparty_value');
v_masterid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._masterid_value');
timezoneruleversionnumber := CkJsonObject_IntOf(jsonResponse,'value[i].timezoneruleversionnumber');
entityimageid := CkJsonObject__stringOf(jsonResponse,'value[i].entityimageid');
v_primarycontactid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._primarycontactid_value');
importsequencenumber := CkJsonObject_IntOf(jsonResponse,'value[i].importsequencenumber');
v_owningteam_value := CkJsonObject__stringOf(jsonResponse,'value[i]._owningteam_value');
routecase := CkJsonObject_BoolOf(jsonResponse,'value[i].routecase');
blockedprofile := CkJsonObject_BoolOf(jsonResponse,'value[i].blockedprofile');
statecode := CkJsonObject_IntOf(jsonResponse,'value[i].statecode');
int_casecategory := CkJsonObject__stringOf(jsonResponse,'value[i].int_casecategory');
entityimage_timestamp := CkJsonObject__stringOf(jsonResponse,'value[i].entityimage_timestamp');
firstresponseslastatus := CkJsonObject_IntOf(jsonResponse,'value[i].firstresponseslastatus');
traversedpath := CkJsonObject__stringOf(jsonResponse,'value[i].traversedpath');
int_actualsatisfaction := CkJsonObject__stringOf(jsonResponse,'value[i].int_actualsatisfaction');
v_int_associatedproduct_value := CkJsonObject__stringOf(jsonResponse,'value[i]._int_associatedproduct_value');
v_customerid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._customerid_value');
entityimage := CkJsonObject__stringOf(jsonResponse,'value[i].entityimage');
v_entitlementid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._entitlementid_value');
activitiescomplete := CkJsonObject_BoolOf(jsonResponse,'value[i].activitiescomplete');
new_upsellreferral := CkJsonObject__stringOf(jsonResponse,'value[i].new_upsellreferral');
statuscode := CkJsonObject_IntOf(jsonResponse,'value[i].statuscode');
processid := CkJsonObject__stringOf(jsonResponse,'value[i].processid');
v_contractdetailid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._contractdetailid_value');
int_customereffort := CkJsonObject_IntOf(jsonResponse,'value[i].int_customereffort');
responseby := CkJsonObject__stringOf(jsonResponse,'value[i].responseby');
v_transactioncurrencyid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._transactioncurrencyid_value');
sentimentvalue := CkJsonObject__stringOf(jsonResponse,'value[i].sentimentvalue');
v_slaid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._slaid_value');
influencescore := CkJsonObject__stringOf(jsonResponse,'value[i].influencescore');
v_firstresponsebykpiid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._firstresponsebykpiid_value');
utcconversiontimezonecode := CkJsonObject__stringOf(jsonResponse,'value[i].utcconversiontimezonecode');
numberofchildincidents := CkJsonObject__stringOf(jsonResponse,'value[i].numberofchildincidents');
incidentid := CkJsonObject__stringOf(jsonResponse,'value[i].incidentid');
new_casecategory := CkJsonObject__stringOf(jsonResponse,'value[i].new_casecategory');
v_owningbusinessunit_value := CkJsonObject__stringOf(jsonResponse,'value[i]._owningbusinessunit_value');
casetypecode := CkJsonObject_IntOf(jsonResponse,'value[i].casetypecode');
resolvebyslastatus := CkJsonObject_IntOf(jsonResponse,'value[i].resolvebyslastatus');
createdon := CkJsonObject__stringOf(jsonResponse,'value[i].createdon');
severitycode := CkJsonObject_IntOf(jsonResponse,'value[i].severitycode');
exchangerate := CkJsonObject__stringOf(jsonResponse,'value[i].exchangerate');
v_subjectid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._subjectid_value');
servicestage := CkJsonObject_IntOf(jsonResponse,'value[i].servicestage');
description := CkJsonObject__stringOf(jsonResponse,'value[i].description');
lastonholdtime := CkJsonObject__stringOf(jsonResponse,'value[i].lastonholdtime');
actualserviceunits := CkJsonObject__stringOf(jsonResponse,'value[i].actualserviceunits');
title := CkJsonObject__stringOf(jsonResponse,'value[i].title');
v_createdby_value := CkJsonObject__stringOf(jsonResponse,'value[i]._createdby_value');
isdecrementing := CkJsonObject_BoolOf(jsonResponse,'value[i].isdecrementing');
v_modifiedonbehalfby_value := CkJsonObject__stringOf(jsonResponse,'value[i]._modifiedonbehalfby_value');
customersatisfactioncode := CkJsonObject_IntOf(jsonResponse,'value[i].customersatisfactioncode');
stageid := CkJsonObject__stringOf(jsonResponse,'value[i].stageid');
v_kbarticleid_value := CkJsonObject__stringOf(jsonResponse,'value[i]._kbarticleid_value');
entityimage_url := CkJsonObject__stringOf(jsonResponse,'value[i].entityimage_url');
firstresponsesent := CkJsonObject_BoolOf(jsonResponse,'value[i].firstresponsesent');
incidentstagecode := CkJsonObject_IntOf(jsonResponse,'value[i].incidentstagecode');
customerid_accountAccountid := CkJsonObject__stringOf(jsonResponse,'value[i].customerid_account.accountid');
customerid_accountName := CkJsonObject__stringOf(jsonResponse,'value[i].customerid_account.name');
i := i + 1;
end;
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jsonResponse);
{
"@odata.context": "https://mydomain.api.crm.dynamics.com/api/data/v9.0/$metadata#incidents(customerid_account(accountid,name))",
"value": [
{
"@odata.etag": "W/\"1161596\"",
"_resolvebykpiid_value": null,
"customercontacted": false,
"_accountid_value": null,
"prioritycode": 2,
"_msdyn_incidenttype_value": null,
"caseorigincode": 2,
"modifiedon": "2018-03-03T12:34:48Z",
"_parentcaseid_value": null,
"_slainvokedid_value": null,
"overriddencreatedon": "2018-03-03T12:34:48Z",
"isescalated": false,
"int_paraturecasenumber": null,
"checkemail": false,
"followupby": "2015-06-04T16:15:42Z",
"ticketnumber": "CAS-01220-S1K8F4",
"versionnumber": 1161596,
"_modifiedby_value": "32ff7175-0dbe-4acb-872e-22f86435bf98",
"billedserviceunits": null,
"decremententitlementterm": true,
"onholdtime": null,
"resolveby": "2015-06-05T16:15:42Z",
"int_upsellreferral": false,
"messagetypecode": null,
"emailaddress": null,
"merged": false,
"int_surveryparticipation": null,
"contractservicelevelcode": null,
"_createdonbehalfby_value": null,
"_contactid_value": null,
"_existingcase_value": null,
"productserialnumber": null,
"_owninguser_value": "32ff7175-0dbe-4acb-872e-22f86435bf98",
"int_effortnum": null,
"escalatedon": null,
"_productid_value": "3509d8af-7bc3-e411-80df-fc15b42886e8",
"followuptaskcreated": false,
"_ownerid_value": "32ff7175-0dbe-4acb-872e-22f86435bf98",
"new_actualsatisfaction": null,
"_socialprofileid_value": null,
"_createdbyexternalparty_value": null,
"_contractid_value": null,
"_modifiedbyexternalparty_value": null,
"_masterid_value": null,
"timezoneruleversionnumber": 0,
"entityimageid": null,
"_primarycontactid_value": null,
"importsequencenumber": 124,
"_owningteam_value": null,
"routecase": true,
"blockedprofile": false,
"statecode": 0,
"int_casecategory": null,
"entityimage_timestamp": null,
"firstresponseslastatus": 1,
"traversedpath": null,
"int_actualsatisfaction": null,
"_int_associatedproduct_value": null,
"_customerid_value": "b6a19cdd-88df-e311-b8e5-6c3be5a8b200",
"entityimage": null,
"_entitlementid_value": null,
"activitiescomplete": false,
"new_upsellreferral": null,
"statuscode": 1,
"processid": "0ffbcde4-61c1-4355-aa89-aa1d7b2b8792",
"_contractdetailid_value": null,
"int_customereffort": 121590000,
"responseby": null,
"_transactioncurrencyid_value": null,
"sentimentvalue": null,
"_slaid_value": null,
"influencescore": null,
"_firstresponsebykpiid_value": null,
"utcconversiontimezonecode": null,
"numberofchildincidents": null,
"incidentid": "c49e62a8-90df-e311-9565-a45d36fc5fe8",
"new_casecategory": null,
"_owningbusinessunit_value": "c4106190-c81e-e811-a980-000d3a192e9a",
"casetypecode": 2,
"resolvebyslastatus": 1,
"createdon": "2017-01-20T22:50:47Z",
"severitycode": 1,
"exchangerate": null,
"_subjectid_value": "191de3d1-21d5-e411-80eb-c4346bad3638",
"servicestage": 0,
"description": null,
"lastonholdtime": null,
"actualserviceunits": null,
"title": "Faulty product catalog",
"_createdby_value": "32ff7175-0dbe-4acb-872e-22f86435bf98",
"isdecrementing": false,
"_modifiedonbehalfby_value": null,
"customersatisfactioncode": 3,
"stageid": "92a6721b-d465-4d36-aef7-e8822d7a5a6a",
"_kbarticleid_value": null,
"entityimage_url": null,
"firstresponsesent": false,
"incidentstagecode": 1,
"customerid_account": {
"accountid": "b6a19cdd-88df-e311-b8e5-6c3be5a8b200",
"name": "Fourth Coffee"
}
}
]
}