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: TChilkatRest;
success: Integer;
bTls: Integer;
port: Integer;
bAutoReconnect: Integer;
sbResponseBody: TChilkatStringBuilder;
respStatusCode: Integer;
jsonResponse: TChilkatJsonObject;
i: Integer;
count_i: Integer;
odataContext: WideString;
odataEtag: WideString;
v_resolvebykpiid_value: WideString;
customercontacted: Integer;
v_accountid_value: WideString;
prioritycode: Integer;
v_msdyn_incidenttype_value: WideString;
caseorigincode: Integer;
modifiedon: WideString;
v_parentcaseid_value: WideString;
v_slainvokedid_value: WideString;
overriddencreatedon: WideString;
isescalated: Integer;
int_paraturecasenumber: WideString;
checkemail: Integer;
followupby: WideString;
ticketnumber: WideString;
versionnumber: Integer;
v_modifiedby_value: WideString;
billedserviceunits: WideString;
decremententitlementterm: Integer;
onholdtime: WideString;
resolveby: WideString;
int_upsellreferral: Integer;
messagetypecode: WideString;
emailaddress: WideString;
merged: Integer;
int_surveryparticipation: WideString;
contractservicelevelcode: WideString;
v_createdonbehalfby_value: WideString;
v_contactid_value: WideString;
v_existingcase_value: WideString;
productserialnumber: WideString;
v_owninguser_value: WideString;
int_effortnum: WideString;
escalatedon: WideString;
v_productid_value: WideString;
followuptaskcreated: Integer;
v_ownerid_value: WideString;
new_actualsatisfaction: WideString;
v_socialprofileid_value: WideString;
v_createdbyexternalparty_value: WideString;
v_contractid_value: WideString;
v_modifiedbyexternalparty_value: WideString;
v_masterid_value: WideString;
timezoneruleversionnumber: Integer;
entityimageid: WideString;
v_primarycontactid_value: WideString;
importsequencenumber: Integer;
v_owningteam_value: WideString;
routecase: Integer;
blockedprofile: Integer;
statecode: Integer;
int_casecategory: WideString;
entityimage_timestamp: WideString;
firstresponseslastatus: Integer;
traversedpath: WideString;
int_actualsatisfaction: WideString;
v_int_associatedproduct_value: WideString;
v_customerid_value: WideString;
entityimage: WideString;
v_entitlementid_value: WideString;
activitiescomplete: Integer;
new_upsellreferral: WideString;
statuscode: Integer;
processid: WideString;
v_contractdetailid_value: WideString;
int_customereffort: Integer;
responseby: WideString;
v_transactioncurrencyid_value: WideString;
sentimentvalue: WideString;
v_slaid_value: WideString;
influencescore: WideString;
v_firstresponsebykpiid_value: WideString;
utcconversiontimezonecode: WideString;
numberofchildincidents: WideString;
incidentid: WideString;
new_casecategory: WideString;
v_owningbusinessunit_value: WideString;
casetypecode: Integer;
resolvebyslastatus: Integer;
createdon: WideString;
severitycode: Integer;
exchangerate: WideString;
v_subjectid_value: WideString;
servicestage: Integer;
description: WideString;
lastonholdtime: WideString;
actualserviceunits: WideString;
title: WideString;
v_createdby_value: WideString;
isdecrementing: Integer;
v_modifiedonbehalfby_value: WideString;
customersatisfactioncode: Integer;
stageid: WideString;
v_kbarticleid_value: WideString;
entityimage_url: WideString;
firstresponsesent: Integer;
incidentstagecode: Integer;
customerid_accountAccountid: WideString;
customerid_accountName: WideString;
begin
rest := TChilkatRest.Create(Self);
// URL: https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/incidents
bTls := 1;
port := 443;
bAutoReconnect := 1;
success := rest.Connect('my-dynamics-domain.api.crm.dynamics.com',port,bTls,bAutoReconnect);
if (success <> 1) then
begin
Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(rest.ConnectFailReason));
Memo1.Lines.Add(rest.LastErrorText);
Exit;
end;
rest.AddQueryParam('$expand','customerid_account($select=accountid,name)');
rest.AddQueryParam('$filter','incidentid eq c49e62a8-90df-e311-9565-a45d36fc5fe8');
rest.AddHeader('OData-MaxVersion','4.0');
rest.AddHeader('Accept','application/json');
rest.AddHeader('OData-Version','4.0');
rest.AddHeader('Authorization','Bearer DYNAMICS_CRM_ACCESS_TOKEN');
sbResponseBody := TChilkatStringBuilder.Create(Self);
success := rest.FullRequestNoBodySb('GET','/api/data/v9.0/incidents',sbResponseBody.ControlInterface);
if (success <> 1) then
begin
Memo1.Lines.Add(rest.LastErrorText);
Exit;
end;
respStatusCode := rest.ResponseStatusCode;
if (respStatusCode >= 400) then
begin
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
Memo1.Lines.Add('Response Header:');
Memo1.Lines.Add(rest.ResponseHeader);
Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(sbResponseBody.GetAsString());
Exit;
end;
jsonResponse := TChilkatJsonObject.Create(Self);
jsonResponse.LoadSb(sbResponseBody.ControlInterface);
odataContext := jsonResponse.StringOf('"@odata.context"');
i := 0;
count_i := jsonResponse.SizeOfArray('value');
while i < count_i do
begin
jsonResponse.I := i;
odataEtag := jsonResponse.StringOf('value[i]."@odata.etag"');
v_resolvebykpiid_value := jsonResponse.StringOf('value[i]._resolvebykpiid_value');
customercontacted := jsonResponse.BoolOf('value[i].customercontacted');
v_accountid_value := jsonResponse.StringOf('value[i]._accountid_value');
prioritycode := jsonResponse.IntOf('value[i].prioritycode');
v_msdyn_incidenttype_value := jsonResponse.StringOf('value[i]._msdyn_incidenttype_value');
caseorigincode := jsonResponse.IntOf('value[i].caseorigincode');
modifiedon := jsonResponse.StringOf('value[i].modifiedon');
v_parentcaseid_value := jsonResponse.StringOf('value[i]._parentcaseid_value');
v_slainvokedid_value := jsonResponse.StringOf('value[i]._slainvokedid_value');
overriddencreatedon := jsonResponse.StringOf('value[i].overriddencreatedon');
isescalated := jsonResponse.BoolOf('value[i].isescalated');
int_paraturecasenumber := jsonResponse.StringOf('value[i].int_paraturecasenumber');
checkemail := jsonResponse.BoolOf('value[i].checkemail');
followupby := jsonResponse.StringOf('value[i].followupby');
ticketnumber := jsonResponse.StringOf('value[i].ticketnumber');
versionnumber := jsonResponse.IntOf('value[i].versionnumber');
v_modifiedby_value := jsonResponse.StringOf('value[i]._modifiedby_value');
billedserviceunits := jsonResponse.StringOf('value[i].billedserviceunits');
decremententitlementterm := jsonResponse.BoolOf('value[i].decremententitlementterm');
onholdtime := jsonResponse.StringOf('value[i].onholdtime');
resolveby := jsonResponse.StringOf('value[i].resolveby');
int_upsellreferral := jsonResponse.BoolOf('value[i].int_upsellreferral');
messagetypecode := jsonResponse.StringOf('value[i].messagetypecode');
emailaddress := jsonResponse.StringOf('value[i].emailaddress');
merged := jsonResponse.BoolOf('value[i].merged');
int_surveryparticipation := jsonResponse.StringOf('value[i].int_surveryparticipation');
contractservicelevelcode := jsonResponse.StringOf('value[i].contractservicelevelcode');
v_createdonbehalfby_value := jsonResponse.StringOf('value[i]._createdonbehalfby_value');
v_contactid_value := jsonResponse.StringOf('value[i]._contactid_value');
v_existingcase_value := jsonResponse.StringOf('value[i]._existingcase_value');
productserialnumber := jsonResponse.StringOf('value[i].productserialnumber');
v_owninguser_value := jsonResponse.StringOf('value[i]._owninguser_value');
int_effortnum := jsonResponse.StringOf('value[i].int_effortnum');
escalatedon := jsonResponse.StringOf('value[i].escalatedon');
v_productid_value := jsonResponse.StringOf('value[i]._productid_value');
followuptaskcreated := jsonResponse.BoolOf('value[i].followuptaskcreated');
v_ownerid_value := jsonResponse.StringOf('value[i]._ownerid_value');
new_actualsatisfaction := jsonResponse.StringOf('value[i].new_actualsatisfaction');
v_socialprofileid_value := jsonResponse.StringOf('value[i]._socialprofileid_value');
v_createdbyexternalparty_value := jsonResponse.StringOf('value[i]._createdbyexternalparty_value');
v_contractid_value := jsonResponse.StringOf('value[i]._contractid_value');
v_modifiedbyexternalparty_value := jsonResponse.StringOf('value[i]._modifiedbyexternalparty_value');
v_masterid_value := jsonResponse.StringOf('value[i]._masterid_value');
timezoneruleversionnumber := jsonResponse.IntOf('value[i].timezoneruleversionnumber');
entityimageid := jsonResponse.StringOf('value[i].entityimageid');
v_primarycontactid_value := jsonResponse.StringOf('value[i]._primarycontactid_value');
importsequencenumber := jsonResponse.IntOf('value[i].importsequencenumber');
v_owningteam_value := jsonResponse.StringOf('value[i]._owningteam_value');
routecase := jsonResponse.BoolOf('value[i].routecase');
blockedprofile := jsonResponse.BoolOf('value[i].blockedprofile');
statecode := jsonResponse.IntOf('value[i].statecode');
int_casecategory := jsonResponse.StringOf('value[i].int_casecategory');
entityimage_timestamp := jsonResponse.StringOf('value[i].entityimage_timestamp');
firstresponseslastatus := jsonResponse.IntOf('value[i].firstresponseslastatus');
traversedpath := jsonResponse.StringOf('value[i].traversedpath');
int_actualsatisfaction := jsonResponse.StringOf('value[i].int_actualsatisfaction');
v_int_associatedproduct_value := jsonResponse.StringOf('value[i]._int_associatedproduct_value');
v_customerid_value := jsonResponse.StringOf('value[i]._customerid_value');
entityimage := jsonResponse.StringOf('value[i].entityimage');
v_entitlementid_value := jsonResponse.StringOf('value[i]._entitlementid_value');
activitiescomplete := jsonResponse.BoolOf('value[i].activitiescomplete');
new_upsellreferral := jsonResponse.StringOf('value[i].new_upsellreferral');
statuscode := jsonResponse.IntOf('value[i].statuscode');
processid := jsonResponse.StringOf('value[i].processid');
v_contractdetailid_value := jsonResponse.StringOf('value[i]._contractdetailid_value');
int_customereffort := jsonResponse.IntOf('value[i].int_customereffort');
responseby := jsonResponse.StringOf('value[i].responseby');
v_transactioncurrencyid_value := jsonResponse.StringOf('value[i]._transactioncurrencyid_value');
sentimentvalue := jsonResponse.StringOf('value[i].sentimentvalue');
v_slaid_value := jsonResponse.StringOf('value[i]._slaid_value');
influencescore := jsonResponse.StringOf('value[i].influencescore');
v_firstresponsebykpiid_value := jsonResponse.StringOf('value[i]._firstresponsebykpiid_value');
utcconversiontimezonecode := jsonResponse.StringOf('value[i].utcconversiontimezonecode');
numberofchildincidents := jsonResponse.StringOf('value[i].numberofchildincidents');
incidentid := jsonResponse.StringOf('value[i].incidentid');
new_casecategory := jsonResponse.StringOf('value[i].new_casecategory');
v_owningbusinessunit_value := jsonResponse.StringOf('value[i]._owningbusinessunit_value');
casetypecode := jsonResponse.IntOf('value[i].casetypecode');
resolvebyslastatus := jsonResponse.IntOf('value[i].resolvebyslastatus');
createdon := jsonResponse.StringOf('value[i].createdon');
severitycode := jsonResponse.IntOf('value[i].severitycode');
exchangerate := jsonResponse.StringOf('value[i].exchangerate');
v_subjectid_value := jsonResponse.StringOf('value[i]._subjectid_value');
servicestage := jsonResponse.IntOf('value[i].servicestage');
description := jsonResponse.StringOf('value[i].description');
lastonholdtime := jsonResponse.StringOf('value[i].lastonholdtime');
actualserviceunits := jsonResponse.StringOf('value[i].actualserviceunits');
title := jsonResponse.StringOf('value[i].title');
v_createdby_value := jsonResponse.StringOf('value[i]._createdby_value');
isdecrementing := jsonResponse.BoolOf('value[i].isdecrementing');
v_modifiedonbehalfby_value := jsonResponse.StringOf('value[i]._modifiedonbehalfby_value');
customersatisfactioncode := jsonResponse.IntOf('value[i].customersatisfactioncode');
stageid := jsonResponse.StringOf('value[i].stageid');
v_kbarticleid_value := jsonResponse.StringOf('value[i]._kbarticleid_value');
entityimage_url := jsonResponse.StringOf('value[i].entityimage_url');
firstresponsesent := jsonResponse.BoolOf('value[i].firstresponsesent');
incidentstagecode := jsonResponse.IntOf('value[i].incidentstagecode');
customerid_accountAccountid := jsonResponse.StringOf('value[i].customerid_account.accountid');
customerid_accountName := jsonResponse.StringOf('value[i].customerid_account.name');
i := i + 1;
end;
{
"@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"
}
}
]
}