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"
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;
import android.app.Activity;
import com.chilkatsoft.*;
import android.widget.TextView;
import android.os.Bundle;
public class SimpleActivity extends Activity {
private static final String TAG = "Chilkat";
// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CkRest rest = new CkRest();
boolean success;
// URL: https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/phonecalls
boolean bTls = true;
int port = 443;
boolean bAutoReconnect = true;
success = rest.Connect("my-dynamics-domain.api.crm.dynamics.com",port,bTls,bAutoReconnect);
if (success != true) {
Log.i(TAG, "ConnectFailReason: " + String.valueOf(rest.get_ConnectFailReason()));
Log.i(TAG, 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");
CkStringBuilder sbResponseBody = new CkStringBuilder();
success = rest.FullRequestNoBodySb("GET","/api/data/v9.0/phonecalls",sbResponseBody);
if (success != true) {
Log.i(TAG, rest.lastErrorText());
return;
}
int respStatusCode = rest.get_ResponseStatusCode();
if (respStatusCode >= 400) {
Log.i(TAG, "Response Status Code = " + String.valueOf(respStatusCode));
Log.i(TAG, "Response Header:");
Log.i(TAG, rest.responseHeader());
Log.i(TAG, "Response Body:");
Log.i(TAG, sbResponseBody.getAsString());
return;
}
CkJsonObject jsonResponse = new CkJsonObject();
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.put_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;
}
}
static {
System.loadLibrary("chilkat");
// Note: If the incorrect library name is passed to System.loadLibrary,
// then you will see the following error message at application startup:
//"The application <your-application-name> has stopped unexpectedly. Please try again."
}
}
{
"@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"
}
]
}