Reputation: 4136
I am running into an issue where items I am creating are being set to deleted and not showing up in QBO.
Here is my code:
OAuthRequestValidator oauthValidator = new OAuthRequestValidator(
accessToken, accessTokenSecret, GetApiConsumerKey(), GetApiConsumerKeySecret());
ServiceContext context = new ServiceContext(GetApiAppToken(),
realmID, IntuitServicesType.QBO, oauthValidator);
context.IppConfiguration.BaseUrl.Qbo = "https://sandbox-quickbooks.api.intuit.com/";
context.IppConfiguration.Message.Request.SerializationFormat = SerializationFormat.Json;
context.IppConfiguration.Message.Response.SerializationFormat = SerializationFormat.Json;
DataService dataService = new DataService(context);
Customer customer = new Customer();
customer.Active = true;
customer.GivenName = "Test";
customer.DisplayName = "Test";
customer.WebAddr = new WebSiteAddress();
customer.WebAddr.URI = "http://www.google.com";
customer = dataService.Add<Customer>(customer);
if (customer.status == EntityStatusEnum.Deleted)
{
// Gets to here every time.
}
Can anyone see what might be going wrong here that causes every created entity to be deleted? I also can't find them using search in the QBO UI.
EDIT
As requested, I am adding the JSON data being sent/recieved:
{// Sent JSON
"GivenName":"Martin",
"FamilyName":"Noreke",
"DisplayName":"Martin Noreke",
"WebAddr":{"URI":"http://www.google.com"}
}
{// Received JSON
"Customer":{
"Taxable":true,
"Job":false,
"BillWithParent":false,
"Balance":0,
"BalanceWithJobs":0,
"CurrencyRef":{"value":"USD","name":"United States Dollar"},
"PreferredDeliveryMethod":"Print",
"domain":"QBO",
"sparse":false,
"Id":"68",
"SyncToken":"0",
"MetaData":{"CreateTime":"2015-07-19T08:25:22-07:00","LastUpdatedTime":"2015-07-19T08:25:22-07:00"},
"GivenName":"Martin",
"FamilyName":"Noreke",
"FullyQualifiedName":"Martin Noreke",
"DisplayName":"Martin Noreke",
"PrintOnCheckName":"Martin Noreke",
"Active":true,
"WebAddr":{"URI":"http://www.google.com"},
"DefaultTaxCodeRef":{"value":"2"}},
"time":"2015-07-19T08:25:22.958-07:00"
}
From the JSON, it appears to be creating the customer correctly. However, I am not able to locate it in the sandbox account I am connecting to.
Upvotes: 0
Views: 579
Reputation: 4136
This is where I get to post the self deprecating story about how I wasn't paying attention.
While working with the API, I somehow created a second company. Even when clicking on the first company, Intuit remembers your last company and takes you straight there.
Using the gear menu to switch companies allowed me to get to the right company so that I could see my created data.
I feel quite silly right now... :/
Upvotes: 1