Returns the full contact record for a given contactid.
curl -X GET https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/contacts(1fa1e5b9-88df-e311-b8e5-6c3be5a8b200) \
-H "Accept: application/json" \
-H "OData-MaxVersion: 4.0" \
-H "OData-Version: 4.0" \
-H "Authorization: Bearer DYNAMICS_CRM_ACCESS_TOKEN"
func chilkatTest() {
let rest = CkoRest()
var success: Bool
// URL: https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/contacts(1fa1e5b9-88df-e311-b8e5-6c3be5a8b200)
var bTls: Bool = true
var port: Int = 443
var bAutoReconnect: Bool = true
success = rest.Connect("my-dynamics-domain.api.crm.dynamics.com", port: port, tls: bTls, autoReconnect: bAutoReconnect)
if success != true {
print("ConnectFailReason: \(rest.ConnectFailReason.intValue)")
print("\(rest.LastErrorText)")
return
}
rest.AddHeader("OData-MaxVersion", value: "4.0")
rest.AddHeader("Accept", value: "application/json")
rest.AddHeader("OData-Version", value: "4.0")
rest.AddHeader("Authorization", value: "Bearer DYNAMICS_CRM_ACCESS_TOKEN")
let sbResponseBody = CkoStringBuilder()
success = rest.FullRequestNoBodySb("GET", uriPath: "/api/data/v9.0/contacts(1fa1e5b9-88df-e311-b8e5-6c3be5a8b200)", sb: sbResponseBody)
if success != true {
print("\(rest.LastErrorText)")
return
}
var respStatusCode: Int = rest.ResponseStatusCode.intValue
if respStatusCode >= 400 {
print("Response Status Code = \(respStatusCode)")
print("Response Header:")
print("\(rest.ResponseHeader)")
print("Response Body:")
print("\(sbResponseBody.GetAsString())")
return
}
let jsonResponse = CkoJsonObject()
jsonResponse.LoadSb(sbResponseBody)
var odataContext: String? = jsonResponse.StringOf("\"@odata.context\"")
var odataEtag: String? = jsonResponse.StringOf("\"@odata.etag\"")
var customertypecode: Int = jsonResponse.IntOf("customertypecode").intValue
var address1_latitude: Int = jsonResponse.IntOf("address1_latitude").intValue
var birthdate: String? = jsonResponse.StringOf("birthdate")
var merged: Bool = jsonResponse.BoolOf("merged")
var gendercode: Int = jsonResponse.IntOf("gendercode").intValue
var territorycode: Int = jsonResponse.IntOf("territorycode").intValue
var emailaddress1: String? = jsonResponse.StringOf("emailaddress1")
var haschildrencode: Int = jsonResponse.IntOf("haschildrencode").intValue
var preferredappointmenttimecode: Int = jsonResponse.IntOf("preferredappointmenttimecode").intValue
var isbackofficecustomer: Bool = jsonResponse.BoolOf("isbackofficecustomer")
var modifiedon: String? = jsonResponse.StringOf("modifiedon")
var v_owninguser_value: String? = jsonResponse.StringOf("_owninguser_value")
var importsequencenumber: Int = jsonResponse.IntOf("importsequencenumber").intValue
var address1_composite: String? = jsonResponse.StringOf("address1_composite")
var address1_longitude: Int = jsonResponse.IntOf("address1_longitude").intValue
var marketingonly: Bool = jsonResponse.BoolOf("marketingonly")
var donotphone: Bool = jsonResponse.BoolOf("donotphone")
var preferredcontactmethodcode: Int = jsonResponse.IntOf("preferredcontactmethodcode").intValue
var educationcode: Int = jsonResponse.IntOf("educationcode").intValue
var v_ownerid_value: String? = jsonResponse.StringOf("_ownerid_value")
var customersizecode: Int = jsonResponse.IntOf("customersizecode").intValue
var firstname: String? = jsonResponse.StringOf("firstname")
var donotpostalmail: Bool = jsonResponse.BoolOf("donotpostalmail")
var yomifullname: String? = jsonResponse.StringOf("yomifullname")
var address2_addresstypecode: Int = jsonResponse.IntOf("address2_addresstypecode").intValue
var donotemail: Bool = jsonResponse.BoolOf("donotemail")
var address2_shippingmethodcode: Int = jsonResponse.IntOf("address2_shippingmethodcode").intValue
var fullname: String? = jsonResponse.StringOf("fullname")
var timezoneruleversionnumber: Int = jsonResponse.IntOf("timezoneruleversionnumber").intValue
var address1_addressid: String? = jsonResponse.StringOf("address1_addressid")
var address2_freighttermscode: Int = jsonResponse.IntOf("address2_freighttermscode").intValue
var statuscode: Int = jsonResponse.IntOf("statuscode").intValue
var createdon: String? = jsonResponse.StringOf("createdon")
var address1_stateorprovince: String? = jsonResponse.StringOf("address1_stateorprovince")
var lastname: String? = jsonResponse.StringOf("lastname")
var donotsendmm: Bool = jsonResponse.BoolOf("donotsendmm")
var donotfax: Bool = jsonResponse.BoolOf("donotfax")
var leadsourcecode: Int = jsonResponse.IntOf("leadsourcecode").intValue
var address1_country: String? = jsonResponse.StringOf("address1_country")
var versionnumber: Int = jsonResponse.IntOf("versionnumber").intValue
var address1_line1: String? = jsonResponse.StringOf("address1_line1")
var creditonhold: Bool = jsonResponse.BoolOf("creditonhold")
var telephone1: String? = jsonResponse.StringOf("telephone1")
var v_owningbusinessunit_value: String? = jsonResponse.StringOf("_owningbusinessunit_value")
var address3_addressid: String? = jsonResponse.StringOf("address3_addressid")
var donotbulkemail: Bool = jsonResponse.BoolOf("donotbulkemail")
var v_modifiedby_value: String? = jsonResponse.StringOf("_modifiedby_value")
var followemail: Bool = jsonResponse.BoolOf("followemail")
var shippingmethodcode: Int = jsonResponse.IntOf("shippingmethodcode").intValue
var v_createdby_value: String? = jsonResponse.StringOf("_createdby_value")
var address1_city: String? = jsonResponse.StringOf("address1_city")
var donotbulkpostalmail: Bool = jsonResponse.BoolOf("donotbulkpostalmail")
var v_parentcustomerid_value: String? = jsonResponse.StringOf("_parentcustomerid_value")
var contactid: String? = jsonResponse.StringOf("contactid")
var participatesinworkflow: Bool = jsonResponse.BoolOf("participatesinworkflow")
var statecode: Int = jsonResponse.IntOf("statecode").intValue
var overriddencreatedon: String? = jsonResponse.StringOf("overriddencreatedon")
var address2_addressid: String? = jsonResponse.StringOf("address2_addressid")
var address1_postalcode: String? = jsonResponse.StringOf("address1_postalcode")
var int_kloutscore: Int = jsonResponse.IntOf("int_kloutscore").intValue
var spousesname: String? = jsonResponse.StringOf("spousesname")
var emailaddress3: String? = jsonResponse.StringOf("emailaddress3")
var address3_telephone3: String? = jsonResponse.StringOf("address3_telephone3")
var mobilephone: String? = jsonResponse.StringOf("mobilephone")
var utcconversiontimezonecode: String? = jsonResponse.StringOf("utcconversiontimezonecode")
var v_preferredserviceid_value: String? = jsonResponse.StringOf("_preferredserviceid_value")
var address3_shippingmethodcode: String? = jsonResponse.StringOf("address3_shippingmethodcode")
var int_twitterservice: String? = jsonResponse.StringOf("int_twitterservice")
var annualincome: String? = jsonResponse.StringOf("annualincome")
var fax: String? = jsonResponse.StringOf("fax")
var telephone3: String? = jsonResponse.StringOf("telephone3")
var address1_primarycontactname: String? = jsonResponse.StringOf("address1_primarycontactname")
var address3_city: String? = jsonResponse.StringOf("address3_city")
var lastonholdtime: String? = jsonResponse.StringOf("lastonholdtime")
var address2_stateorprovince: String? = jsonResponse.StringOf("address2_stateorprovince")
var address2_line1: String? = jsonResponse.StringOf("address2_line1")
var assistantphone: String? = jsonResponse.StringOf("assistantphone")
var lastusedincampaign: String? = jsonResponse.StringOf("lastusedincampaign")
var address3_freighttermscode: String? = jsonResponse.StringOf("address3_freighttermscode")
var pager: String? = jsonResponse.StringOf("pager")
var employeeid: String? = jsonResponse.StringOf("employeeid")
var managername: String? = jsonResponse.StringOf("managername")
var address1_name: String? = jsonResponse.StringOf("address1_name")
var department: String? = jsonResponse.StringOf("department")
var address3_country: String? = jsonResponse.StringOf("address3_country")
var address2_telephone1: String? = jsonResponse.StringOf("address2_telephone1")
var address2_primarycontactname: String? = jsonResponse.StringOf("address2_primarycontactname")
var address2_latitude: String? = jsonResponse.StringOf("address2_latitude")
var address3_latitude: String? = jsonResponse.StringOf("address3_latitude")
var address2_postalcode: String? = jsonResponse.StringOf("address2_postalcode")
var entityimage_timestamp: String? = jsonResponse.StringOf("entityimage_timestamp")
var v_originatingleadid_value: String? = jsonResponse.StringOf("_originatingleadid_value")
var v_masterid_value: String? = jsonResponse.StringOf("_masterid_value")
var v_createdonbehalfby_value: String? = jsonResponse.StringOf("_createdonbehalfby_value")
var address3_postofficebox: String? = jsonResponse.StringOf("address3_postofficebox")
var subscriptionid: String? = jsonResponse.StringOf("subscriptionid")
var business2: String? = jsonResponse.StringOf("business2")
var address3_county: String? = jsonResponse.StringOf("address3_county")
var address1_telephone2: String? = jsonResponse.StringOf("address1_telephone2")
var address1_freighttermscode: String? = jsonResponse.StringOf("address1_freighttermscode")
var address3_addresstypecode: String? = jsonResponse.StringOf("address3_addresstypecode")
var address1_addresstypecode: String? = jsonResponse.StringOf("address1_addresstypecode")
var aging90_base: String? = jsonResponse.StringOf("aging90_base")
var address3_primarycontactname: String? = jsonResponse.StringOf("address3_primarycontactname")
var familystatuscode: String? = jsonResponse.StringOf("familystatuscode")
var home2: String? = jsonResponse.StringOf("home2")
var int_kloutscoreservice: String? = jsonResponse.StringOf("int_kloutscoreservice")
var address2_utcoffset: String? = jsonResponse.StringOf("address2_utcoffset")
var aging60: String? = jsonResponse.StringOf("aging60")
var telephone2: String? = jsonResponse.StringOf("telephone2")
var yomimiddlename: String? = jsonResponse.StringOf("yomimiddlename")
var v_modifiedonbehalfby_value: String? = jsonResponse.StringOf("_modifiedonbehalfby_value")
var jobtitle: String? = jsonResponse.StringOf("jobtitle")
var address3_utcoffset: String? = jsonResponse.StringOf("address3_utcoffset")
var address1_telephone3: String? = jsonResponse.StringOf("address1_telephone3")
var address2_line2: String? = jsonResponse.StringOf("address2_line2")
var creditlimit_base: String? = jsonResponse.StringOf("creditlimit_base")
var address3_line1: String? = jsonResponse.StringOf("address3_line1")
var address1_county: String? = jsonResponse.StringOf("address1_county")
var v_createdbyexternalparty_value: String? = jsonResponse.StringOf("_createdbyexternalparty_value")
var entityimageid: String? = jsonResponse.StringOf("entityimageid")
var processid: String? = jsonResponse.StringOf("processid")
var int_facebook: String? = jsonResponse.StringOf("int_facebook")
var description: String? = jsonResponse.StringOf("description")
var address1_fax: String? = jsonResponse.StringOf("address1_fax")
var address3_line2: String? = jsonResponse.StringOf("address3_line2")
var externaluseridentifier: String? = jsonResponse.StringOf("externaluseridentifier")
var int_facebookservice: String? = jsonResponse.StringOf("int_facebookservice")
var aging30_base: String? = jsonResponse.StringOf("aging30_base")
var v_callback: String? = jsonResponse.StringOf("callback")
var emailaddress2: String? = jsonResponse.StringOf("emailaddress2")
var address2_line3: String? = jsonResponse.StringOf("address2_line3")
var managerphone: String? = jsonResponse.StringOf("managerphone")
var websiteurl: String? = jsonResponse.StringOf("websiteurl")
var exchangerate: String? = jsonResponse.StringOf("exchangerate")
var address1_telephone1: String? = jsonResponse.StringOf("address1_telephone1")
var address3_composite: String? = jsonResponse.StringOf("address3_composite")
var address3_fax: String? = jsonResponse.StringOf("address3_fax")
var childrensnames: String? = jsonResponse.StringOf("childrensnames")
var v_owningteam_value: String? = jsonResponse.StringOf("_owningteam_value")
var numberofchildren: String? = jsonResponse.StringOf("numberofchildren")
var address2_postofficebox: String? = jsonResponse.StringOf("address2_postofficebox")
var aging90: String? = jsonResponse.StringOf("aging90")
var aging60_base: String? = jsonResponse.StringOf("aging60_base")
var v_transactioncurrencyid_value: String? = jsonResponse.StringOf("_transactioncurrencyid_value")
var entityimage: String? = jsonResponse.StringOf("entityimage")
var v_modifiedbyexternalparty_value: String? = jsonResponse.StringOf("_modifiedbyexternalparty_value")
var paymenttermscode: String? = jsonResponse.StringOf("paymenttermscode")
var address3_name: String? = jsonResponse.StringOf("address3_name")
var ftpsiteurl: String? = jsonResponse.StringOf("ftpsiteurl")
var address1_shippingmethodcode: String? = jsonResponse.StringOf("address1_shippingmethodcode")
var v_preferredsystemuserid_value: String? = jsonResponse.StringOf("_preferredsystemuserid_value")
var address2_telephone2: String? = jsonResponse.StringOf("address2_telephone2")
var v_slainvokedid_value: String? = jsonResponse.StringOf("_slainvokedid_value")
var address3_telephone1: String? = jsonResponse.StringOf("address3_telephone1")
var nickname: String? = jsonResponse.StringOf("nickname")
var address1_postofficebox: String? = jsonResponse.StringOf("address1_postofficebox")
var v_preferredequipmentid_value: String? = jsonResponse.StringOf("_preferredequipmentid_value")
var assistantname: String? = jsonResponse.StringOf("assistantname")
var address2_country: String? = jsonResponse.StringOf("address2_country")
var v_accountid_value: String? = jsonResponse.StringOf("_accountid_value")
var address2_name: String? = jsonResponse.StringOf("address2_name")
var stageid: String? = jsonResponse.StringOf("stageid")
var address3_longitude: String? = jsonResponse.StringOf("address3_longitude")
var onholdtime: String? = jsonResponse.StringOf("onholdtime")
var address2_telephone3: String? = jsonResponse.StringOf("address2_telephone3")
var address3_upszone: String? = jsonResponse.StringOf("address3_upszone")
var aging30: String? = jsonResponse.StringOf("aging30")
var address2_upszone: String? = jsonResponse.StringOf("address2_upszone")
var address1_upszone: String? = jsonResponse.StringOf("address1_upszone")
var creditlimit: String? = jsonResponse.StringOf("creditlimit")
var salutation: String? = jsonResponse.StringOf("salutation")
var traversedpath: String? = jsonResponse.StringOf("traversedpath")
var accountrolecode: String? = jsonResponse.StringOf("accountrolecode")
var address1_utcoffset: String? = jsonResponse.StringOf("address1_utcoffset")
var governmentid: String? = jsonResponse.StringOf("governmentid")
var annualincome_base: String? = jsonResponse.StringOf("annualincome_base")
var address3_stateorprovince: String? = jsonResponse.StringOf("address3_stateorprovince")
var address3_postalcode: String? = jsonResponse.StringOf("address3_postalcode")
var address2_city: String? = jsonResponse.StringOf("address2_city")
var msdyn_gdproptout: String? = jsonResponse.StringOf("msdyn_gdproptout")
var company: String? = jsonResponse.StringOf("company")
var address1_line2: String? = jsonResponse.StringOf("address1_line2")
var address2_longitude: String? = jsonResponse.StringOf("address2_longitude")
var int_twitter: String? = jsonResponse.StringOf("int_twitter")
var address3_telephone2: String? = jsonResponse.StringOf("address3_telephone2")
var yomifirstname: String? = jsonResponse.StringOf("yomifirstname")
var address2_composite: String? = jsonResponse.StringOf("address2_composite")
var address2_county: String? = jsonResponse.StringOf("address2_county")
var suffix: String? = jsonResponse.StringOf("suffix")
var anniversary: String? = jsonResponse.StringOf("anniversary")
var v_parentcontactid_value: String? = jsonResponse.StringOf("_parentcontactid_value")
var address2_fax: String? = jsonResponse.StringOf("address2_fax")
var yomilastname: String? = jsonResponse.StringOf("yomilastname")
var preferredappointmentdaycode: String? = jsonResponse.StringOf("preferredappointmentdaycode")
var entityimage_url: String? = jsonResponse.StringOf("entityimage_url")
var address1_line3: String? = jsonResponse.StringOf("address1_line3")
var v_defaultpricelevelid_value: String? = jsonResponse.StringOf("_defaultpricelevelid_value")
var v_slaid_value: String? = jsonResponse.StringOf("_slaid_value")
var middlename: String? = jsonResponse.StringOf("middlename")
var address3_line3: String? = jsonResponse.StringOf("address3_line3")
var timespentbymeonemailandmeetings: String? = jsonResponse.StringOf("timespentbymeonemailandmeetings")
}
{
"@odata.context": "https://mydomain.api.crm.dynamics.com/api/data/v9.0/$metadata#contacts/$entity",
"@odata.etag": "W/\"1162210\"",
"customertypecode": 1,
"address1_latitude": 35.82096,
"birthdate": "1965-05-24",
"merged": false,
"gendercode": 1,
"territorycode": 1,
"emailaddress1": "tom@cohowinery.com",
"haschildrencode": 1,
"preferredappointmenttimecode": 1,
"isbackofficecustomer": false,
"modifiedon": "2018-03-12T16:09:53Z",
"_owninguser_value": "55e68414-a277-42d6-ba36-d90484708a1d",
"importsequencenumber": 104,
"address1_composite": "4405 Balboa Court\r\nSanta Cruz, NM 72052\r\nUS",
"address1_longitude": -106.21346,
"marketingonly": false,
"donotphone": false,
"preferredcontactmethodcode": 1,
"educationcode": 1,
"_ownerid_value": "55e68414-a277-42d6-ba36-d90484708a1d",
"customersizecode": 1,
"firstname": "Tomasz",
"donotpostalmail": false,
"yomifullname": "Tomasz Bochenek",
"address2_addresstypecode": 1,
"donotemail": false,
"address2_shippingmethodcode": 1,
"fullname": "Tomasz Bochenek",
"timezoneruleversionnumber": 0,
"address1_addressid": "c3a917d8-1daa-463b-a4ac-f6d9878d7456",
"address2_freighttermscode": 1,
"statuscode": 1,
"createdon": "2017-01-20T22:40:01Z",
"address1_stateorprovince": "NM",
"lastname": "Bochenek",
"donotsendmm": false,
"donotfax": false,
"leadsourcecode": 1,
"address1_country": "US",
"versionnumber": 1162210,
"address1_line1": "4405 Balboa Court",
"creditonhold": false,
"telephone1": "456-698-4581",
"_owningbusinessunit_value": "c4106190-c81e-e811-a980-000d3a192e9a",
"address3_addressid": "e3e5cc17-4990-4d08-8a4d-c16ca45217ab",
"donotbulkemail": false,
"_modifiedby_value": "e00ba668-e2de-47bc-8f92-ab9573f92ff4",
"followemail": true,
"shippingmethodcode": 1,
"_createdby_value": "55e68414-a277-42d6-ba36-d90484708a1d",
"address1_city": "Santa Cruz",
"donotbulkpostalmail": false,
"_parentcustomerid_value": "b0a19cdd-88df-e311-b8e5-6c3be5a8b200",
"contactid": "1fa1e5b9-88df-e311-b8e5-6c3be5a8b200",
"participatesinworkflow": false,
"statecode": 0,
"overriddencreatedon": "2018-03-03T12:22:25Z",
"address2_addressid": "fee626cd-e834-4a68-a54e-b98c23847b2d",
"address1_postalcode": "72052",
"int_kloutscore": 90,
"spousesname": null,
"emailaddress3": null,
"address3_telephone3": null,
"mobilephone": null,
"utcconversiontimezonecode": null,
"_preferredserviceid_value": null,
"address3_shippingmethodcode": null,
"int_twitterservice": null,
"annualincome": null,
"fax": null,
"telephone3": null,
"address1_primarycontactname": null,
"address3_city": null,
"lastonholdtime": null,
"address2_stateorprovince": null,
"address2_line1": null,
"assistantphone": null,
"lastusedincampaign": null,
"address3_freighttermscode": null,
"pager": null,
"employeeid": null,
"managername": null,
"address1_name": null,
"department": null,
"address3_country": null,
"address2_telephone1": null,
"address2_primarycontactname": null,
"address2_latitude": null,
"address3_latitude": null,
"address2_postalcode": null,
"entityimage_timestamp": null,
"_originatingleadid_value": null,
"_masterid_value": null,
"_createdonbehalfby_value": null,
"address3_postofficebox": null,
"subscriptionid": null,
"business2": null,
"address3_county": null,
"address1_telephone2": null,
"address1_freighttermscode": null,
"address3_addresstypecode": null,
"address1_addresstypecode": null,
"aging90_base": null,
"address3_primarycontactname": null,
"familystatuscode": null,
"home2": null,
"int_kloutscoreservice": null,
"address2_utcoffset": null,
"aging60": null,
"telephone2": null,
"yomimiddlename": null,
"_modifiedonbehalfby_value": null,
"jobtitle": null,
"address3_utcoffset": null,
"address1_telephone3": null,
"address2_line2": null,
"creditlimit_base": null,
"address3_line1": null,
"address1_county": null,
"_createdbyexternalparty_value": null,
"entityimageid": null,
"processid": null,
"int_facebook": null,
"description": null,
"address1_fax": null,
"address3_line2": null,
"externaluseridentifier": null,
"int_facebookservice": null,
"aging30_base": null,
"callback": null,
"emailaddress2": null,
"address2_line3": null,
"managerphone": null,
"websiteurl": null,
"exchangerate": null,
"address1_telephone1": null,
"address3_composite": null,
"address3_fax": null,
"childrensnames": null,
"_owningteam_value": null,
"numberofchildren": null,
"address2_postofficebox": null,
"aging90": null,
"aging60_base": null,
"_transactioncurrencyid_value": null,
"entityimage": null,
"_modifiedbyexternalparty_value": null,
"paymenttermscode": null,
"address3_name": null,
"ftpsiteurl": null,
"address1_shippingmethodcode": null,
"_preferredsystemuserid_value": null,
"address2_telephone2": null,
"_slainvokedid_value": null,
"address3_telephone1": null,
"nickname": null,
"address1_postofficebox": null,
"_preferredequipmentid_value": null,
"assistantname": null,
"address2_country": null,
"_accountid_value": null,
"address2_name": null,
"stageid": null,
"address3_longitude": null,
"onholdtime": null,
"address2_telephone3": null,
"address3_upszone": null,
"aging30": null,
"address2_upszone": null,
"address1_upszone": null,
"creditlimit": null,
"salutation": null,
"traversedpath": null,
"accountrolecode": null,
"address1_utcoffset": null,
"governmentid": null,
"annualincome_base": null,
"address3_stateorprovince": null,
"address3_postalcode": null,
"address2_city": null,
"msdyn_gdproptout": null,
"company": null,
"address1_line2": null,
"address2_longitude": null,
"int_twitter": null,
"address3_telephone2": null,
"yomifirstname": null,
"address2_composite": null,
"address2_county": null,
"suffix": null,
"anniversary": null,
"_parentcontactid_value": null,
"address2_fax": null,
"yomilastname": null,
"preferredappointmentdaycode": null,
"entityimage_url": null,
"address1_line3": null,
"_defaultpricelevelid_value": null,
"_slaid_value": null,
"middlename": null,
"address3_line3": null,
"timespentbymeonemailandmeetings": null
}