Creates a phone call record regarding the Fourth Coffee account (b6a19cdd-88df-e311-b8e5-6c3be5a8b200), regarding the "Faulty product catalog" incident (c49e62a8-90df-e311-9565-a45d36fc5fe8), from the system user Allie Bellew (832698d1-b86a-47b5-a9a3-0cc710eb22e4), to the contact Gabriele Cannata (57a0e5b9-88df-e311-b8e5-6c3be5a8b200). A successful response is indicated by a 204 response status code with no response body.
curl -X POST https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/phonecalls \
-H "Accept: application/json" \
-H "Content-Type: application/json; charset=utf-8" \
-H "OData-MaxVersion: 4.0" \
-H "OData-Version: 4.0" \
-H "Authorization: Bearer DYNAMICS_CRM_ACCESS_TOKEN" \
-d '{
"subject": "Sample Phone Call 123",
"phonenumber": "3125551920",
"description": "Sample phone call created using the Chilkat Rest API",
"scheduledend": "2018-04-29T11:56:21Z",
"regardingobjectid_account@odata.bind": "/accounts(b6a19cdd-88df-e311-b8e5-6c3be5a8b200)",
"actualdurationminutes": 25,
"directioncode": true,
"phonecall_activity_parties": [
{ "partyid_systemuser@odata.bind": "/systemusers(832698d1-b86a-47b5-a9a3-0cc710eb22e4)",
"participationtypemask": 1 },
{ "partyid_contact@odata.bind": "/contacts(57a0e5b9-88df-e311-b8e5-6c3be5a8b200)",
"participationtypemask": 2 },
{ "partyid_incident@odata.bind": "/incidents(c49e62a8-90df-e311-9565-a45d36fc5fe8)",
"participationtypemask": 8 }
]
}'
// 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;
}
CkJsonObject json = new CkJsonObject();
json.UpdateString("subject","Sample Phone Call 123");
json.UpdateString("phonenumber","3125551920");
json.UpdateString("description","Sample phone call created using the Chilkat Rest API");
json.UpdateString("scheduledend","2018-04-29T11:56:21Z");
json.UpdateString("\"regardingobjectid_account@odata.bind\"","/accounts(b6a19cdd-88df-e311-b8e5-6c3be5a8b200)");
json.UpdateNumber("actualdurationminutes","25");
json.UpdateBool("directioncode",true);
json.UpdateString("phonecall_activity_parties[0].\"partyid_systemuser@odata.bind\"","/systemusers(832698d1-b86a-47b5-a9a3-0cc710eb22e4)");
json.UpdateNumber("phonecall_activity_parties[0].participationtypemask","1");
json.UpdateString("phonecall_activity_parties[1].\"partyid_contact@odata.bind\"","/contacts(57a0e5b9-88df-e311-b8e5-6c3be5a8b200)");
json.UpdateNumber("phonecall_activity_parties[1].participationtypemask","2");
json.UpdateString("phonecall_activity_parties[2].\"partyid_incident@odata.bind\"","/incidents(c49e62a8-90df-e311-9565-a45d36fc5fe8)");
json.UpdateNumber("phonecall_activity_parties[2].participationtypemask","8");
rest.AddHeader("Content-Type","application/json; charset=utf-8");
rest.AddHeader("OData-Version","4.0");
rest.AddHeader("Accept","application/json");
rest.AddHeader("OData-MaxVersion","4.0");
rest.AddHeader("Authorization","Bearer DYNAMICS_CRM_ACCESS_TOKEN");
CkStringBuilder sbRequestBody = new CkStringBuilder();
json.EmitSb(sbRequestBody);
CkStringBuilder sbResponseBody = new CkStringBuilder();
success = rest.FullRequestSb("POST","/api/data/v9.0/phonecalls",sbRequestBody,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;
}
}
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."
}
}