public async Task TestPutAddress() { var reader = CreateApiReader("accountaddresses"); reader.ApiKey = YOURAPIKEY_FULLACCESS; var newAddress = new ApiAccountAddress(); newAddress.AccountId = new Guid("075660f7-6a07-47bc-a05d-f039fc9ad3a7"); newAddress.Address1 = "10550 S. Sam Houston Parkway West"; newAddress.City = "Houston"; await reader.Put(newAddress); }
public async Task TestAddresses() { var reader = CreateApiReader("accountaddresses"); reader.ApiKey = YOURAPIKEY_FULLACCESS; // check existing addresses var allAddresses = await reader.QueryList <ApiAccountAddress>(); // if we do not have an address, create one if (!(await reader.QueryListByFilter <ApiAccountAddress>(ApiReader.BuildFilter("AccountId eq {0}", testAccountId))).Any()) { // an address is separate object and it has its own ID: BranchID // however, BranchId will be phased out // you should use AccountId instead. var newAddress = new ApiAccountAddress(); // make sure you specify valid AccountId newAddress.AccountId = testAccountId; newAddress.Address1 = "123 Main Street"; newAddress.City = "New York"; newAddress.Country = "US"; await reader.Post(newAddress); // to update address, also use specify valid AccountId; remove BranchId from ApiAccountAddress object. var postAddress = new ApiAccountAddress(); postAddress.AccountId = testAccountId; postAddress.Address1 = "Another address"; await reader.Put(testAccountId, postAddress); } // delete await reader.Delete(testAccountId); }