QBO API V3 - SyncToken Does Not Increment When Updating Objects

914 Views Asked by At

I am using the QBO V3 API and am running into issues when updating. I can update an entity once, which successfully returns the entity with an incremented SyncToken, but then after that all subsequent Update calls return the entity unchanged and with the same SyncToken. This happens for all entities that I have tried, Accounts, Invoices, etc.

Here's an example with request and response.

1ST UPDATE - SUCCESSFUL (SyncToken increments up)

REQUEST

POST https://quickbooks.api.intuit.com/v3/company/1234/customer?requestid=29 HTTP/1.1
Content-Type: application/xml
Authorization: OAuth realm="", oauth_signature_method="HMAC-SHA1", oauth_signature="abc",  oauth_nonce="def", oauth_timestamp="1385928116", oauth_token="xyz", oauth_consumer_key="prs", oauth_version="1.0"
Content-Length: 161

<Customer xmlns="http://schema.intuit.com/finance/v3" sparse="true">
<Id>29</Id>
<SyncToken>0</SyncToken>
<GivenName>Test V3 No. 2</GivenName>
</Customer>

RESPONSE

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-12-01T12:01:56.797-08:00">
<Customer domain="QBO" sparse="false">
    <Id>29</Id>
    <SyncToken>1</SyncToken>
<MetaData><CreateTime>2013-12-01T12:01:22-08:00</CreateTime><LastUpdatedTime>2013-12-01T12:01:56-08:00</LastUpdatedTime></MetaData><GivenName>Test V3 No. 2</GivenName><FullyQualifiedName>Test V3 #2</FullyQualifiedName><DisplayName>Test V3 #2</DisplayName><PrintOnCheckName>Test V3 #2</PrintOnCheckName><Active>true</Active><Taxable>false</Taxable><Job>false</Job><BillWithParent>false</BillWithParent><Balance>0</Balance><BalanceWithJobs>0</BalanceWithJobs><PreferredDeliveryMethod>Print</PreferredDeliveryMethod></Customer></IntuitResponse>

2ND UPDATE - FAILS (SyncToken does not increment)

REQUEST

POST https://quickbooks.api.intuit.com/v3/company/1234/customer?requestid=29 HTTP/1.1
Content-Type: application/xml
Authorization: OAuth realm="", oauth_signature_method="HMAC-SHA1", oauth_signature="abc",  oauth_nonce="def", oauth_timestamp="1385928116", oauth_token="xyz", oauth_consumer_key="prs", oauth_version="1.0"
Content-Length: 160

<Customer xmlns="http://schema.intuit.com/finance/v3" sparse="true">
<Id>29</Id>
<SyncToken>1</SyncToken>
<GivenName>Test V3 No 2</GivenName>
</Customer>

RESPONSE

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-12-01T12:02:13.589-08:00">
<Customer domain="QBO" sparse="false">
    <Id>29</Id>
    <SyncToken>1</SyncToken>
<MetaData><CreateTime>2013-12-01T12:01:22-08:00</CreateTime><LastUpdatedTime>2013-12-01T12:01:56-08:00</LastUpdatedTime></MetaData><GivenName>Test V3 No. 2</GivenName><FullyQualifiedName>Test V3 #2</FullyQualifiedName><DisplayName>Test V3 #2</DisplayName><PrintOnCheckName>Test V3 #2</PrintOnCheckName><Active>true</Active><Taxable>false</Taxable><Job>false</Job><BillWithParent>false</BillWithParent><Balance>0</Balance><BalanceWithJobs>0</BalanceWithJobs><PreferredDeliveryMethod>Print</PreferredDeliveryMethod></Customer></IntuitResponse>

Since the response does not give an error, and since the update works the first time but not the second, it would appear there is an error of some sort on QuickBooks' side. Does anyone have any ideas what would cause this, or if there is anything I can do to prevent this?

Thanks!!

1

There are 1 best solutions below

2
On BEST ANSWER

You can try this call using IPP's PHP SDK. I have tested these calls. I'll share raw XML request and response.

PHP Devkit link - https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits

I had tried the following from V3 API Explorer.

Link - https://developer.intuit.com/apiexplorer?apiname=V3QBO#Customer

Customer Create

<Customer xmlns="http://schema.intuit.com/finance/v3" sparse="false">
  <GivenName>TEST</GivenName>
  <FamilyName>TestF</FamilyName>
</Customer>

Create Response

<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-12-03T19:37:51.045-08:00">
  <Customer domain="QBO" sparse="false"
    <Id>5</Id>
    <SyncToken>0</SyncToken>
    <MetaData>
      <CreateTime>2013-12-03T19:37:51-08:00</CreateTime>
      <LastUpdatedTime>2013-12-03T19:37:51-08:00</LastUpdatedTime>
    </MetaData>
    <GivenName>TEST</GivenName>
    <FamilyName>TestF</FamilyName>
    <FullyQualifiedName>TEST TestF</FullyQualifiedName>
    <DisplayName>TEST TestF</DisplayName>
    <PrintOnCheckName>TEST TestF</PrintOnCheckName>
    <Active>true</Active>
    <Taxable>false</Taxable>
    <Job>false</Job>
    <BillWithParent>false</BillWithParent>
    <Balance>0</Balance>
    <BalanceWithJobs>0</BalanceWithJobs>
    <PreferredDeliveryMethod>Print</PreferredDeliveryMethod>
  </Customer>
</IntuitResponse>

First Update Request

<Customer xmlns="http://schema.intuit.com/finance/v3" sparse="true">
    <Id>5</Id>
    <SyncToken>0</SyncToken>
    <GivenName>TEST1</GivenName>
</Customer> 

1st Update Response

<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-12-03T19:40:50.376-08:00">
  <Customer domain="QBO" sparse="false">
    <Id>5</Id>
    <SyncToken>1</SyncToken>
    <MetaData>
      <CreateTime>2013-12-03T19:37:51-08:00</CreateTime>
      <LastUpdatedTime>2013-12-03T19:40:50-08:00</LastUpdatedTime>
    </MetaData>
    <GivenName>TEST1</GivenName>
    <FamilyName>TestF</FamilyName>
    <FullyQualifiedName>TEST TestF</FullyQualifiedName>
    <DisplayName>TEST TestF</DisplayName>
    <PrintOnCheckName>TEST TestF</PrintOnCheckName>
    <Active>true</Active>
    <Taxable>false</Taxable>
    <Job>false</Job>
    <BillWithParent>false</BillWithParent>
    <Balance>0</Balance>
    <BalanceWithJobs>0</BalanceWithJobs>
    <PreferredDeliveryMethod>Print</PreferredDeliveryMethod>
  </Customer>
</IntuitResponse>

2nd Update Request

<Customer xmlns="http://schema.intuit.com/finance/v3" sparse="true">
    <Id>5</Id>
    <SyncToken>1</SyncToken>
    <GivenName>TEST2</GivenName>
</Customer>

2nd Update Response

<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-12-03T19:42:05.712-08:00">
  <Customer domain="QBO" sparse="false">
    <Id>5</Id>
    <SyncToken>2</SyncToken>
    <MetaData>
      <CreateTime>2013-12-03T19:37:51-08:00</CreateTime>
      <LastUpdatedTime>2013-12-03T19:42:05-08:00</LastUpdatedTime>
    </MetaData>
    <GivenName>TEST2</GivenName>
    <FamilyName>TestF</FamilyName>
    <FullyQualifiedName>TEST TestF</FullyQualifiedName>
    <DisplayName>TEST TestF</DisplayName>
    <PrintOnCheckName>TEST TestF</PrintOnCheckName>
    <Active>true</Active>
    <Taxable>false</Taxable>
    <Job>false</Job>
    <BillWithParent>false</BillWithParent>
    <Balance>0</Balance>
    <BalanceWithJobs>0</BalanceWithJobs>
    <PreferredDeliveryMethod>Print</PreferredDeliveryMethod>
  </Customer>
</IntuitResponse>

Thanks