I am trying something like
customer.Uid = Guid.NewGuid()
// set other properties
myCustomerService.Insert(myCompanyFile, myobCustomerContact, myCredentials );
myobCustomerContact = myCustomerService.Get(myCompanyFile, myobCustomerContact.UID,myCredentials);
The Get returns a 404 error.
What am I doing wrong?
You cannot currently control the UID used to insert a new entity; the API will create a new UID on insert for you.
When you use InsertAsync
the task will return a string which is the full URI to the newly inserted entity. You can then retrieve the entity using
var location = await service.InsertAsync(cf, customer, credentials, ct);
var insertedEntity = await service.GetAsync(cf, new Uri(location), credentials, ct);
however if you want to insert and retrieve an inserted entity then you can use InsertExAsync
e.g.
var insertEntity = await service.InsertExAsync(cf, customer, credentials, ct);