Returns the subject, description, start date/time and activity ID for phone calls regarding an account. This example gets the phone calls regarding the Fourth Coffee account (accountid = b6a19cdd-88df-e311-b8e5-6c3be5a8b200).
curl -X GET https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/phonecalls \
-H "Accept: application/json" \
-H "OData-MaxVersion: 4.0" \
-H "OData-Version: 4.0" \
-d "$filter=_regardingobjectid_value eq b6a19cdd-88df-e311-b8e5-6c3be5a8b200" \
-d "$select=subject,description,actualstart,activityid" \
-H "Authorization: Bearer DYNAMICS_CRM_ACCESS_TOKEN"
Chilkat.Rest rest = new Chilkat.Rest();
bool success;
// URL: https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/phonecalls
bool bTls = true;
int port = 443;
bool bAutoReconnect = true;
success = rest.Connect("my-dynamics-domain.api.crm.dynamics.com",port,bTls,bAutoReconnect);
if (success != true) {
Debug.WriteLine("ConnectFailReason: " + Convert.ToString(rest.ConnectFailReason));
Debug.WriteLine(rest.LastErrorText);
return;
}
rest.AddQueryParam("$filter","_regardingobjectid_value eq b6a19cdd-88df-e311-b8e5-6c3be5a8b200");
rest.AddQueryParam("$select","subject,description,actualstart,activityid");
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");
Chilkat.StringBuilder sbResponseBody = new Chilkat.StringBuilder();
success = rest.FullRequestNoBodySb("GET","/api/data/v9.0/phonecalls",sbResponseBody);
if (success != true) {
Debug.WriteLine(rest.LastErrorText);
return;
}
int respStatusCode = rest.ResponseStatusCode;
if (respStatusCode >= 400) {
Debug.WriteLine("Response Status Code = " + Convert.ToString(respStatusCode));
Debug.WriteLine("Response Header:");
Debug.WriteLine(rest.ResponseHeader);
Debug.WriteLine("Response Body:");
Debug.WriteLine(sbResponseBody.GetAsString());
return;
}
Chilkat.JsonObject jsonResponse = new Chilkat.JsonObject();
jsonResponse.LoadSb(sbResponseBody);
int i;
int count_i;
string odataContext = jsonResponse.StringOf("\"@odata.context\"");
i = 0;
count_i = jsonResponse.SizeOfArray("value");
while (i < count_i) {
jsonResponse.I = i;
string odataEtag = jsonResponse.StringOf("value[i].\"@odata.etag\"");
string subject = jsonResponse.StringOf("value[i].subject");
string description = jsonResponse.StringOf("value[i].description");
string actualstart = jsonResponse.StringOf("value[i].actualstart");
string activityid = jsonResponse.StringOf("value[i].activityid");
i = i + 1;
}
{
"@odata.context": "https://mydomain.api.crm.dynamics.com/api/data/v9.0/$metadata#phonecalls(subject,description,actualstart,activityid)",
"value": [
{
"@odata.etag": "W/\"1818469\"",
"subject": "Discussed coffee bean pricing.",
"description": "Discussed coffee bean pricing.",
"actualstart": "2018-04-29T11:56:21Z",
"activityid": "098af854-a44b-e811-a955-000d3a1ca612"
}
]
}