0
votes

I'm using the Intuit Partner Platform v3 QBO API to try to update a Customer object. The sole objective for the purpose of this post is to remove the shipping address.

Here's the original object, queried before the change:

{
    "domain": "QBO", 
    "FamilyName": "last", 
    "DisplayName": "my display name", 
    "Title": "mr.", 
    "PreferredDeliveryMethod": "Print", 
    "GivenName": "first", 
    "FullyQualifiedName": "my display name", 
    "BillWithParent": false, 
    "Job": false, 
    "BalanceWithJobs": 0, 
    "Taxable": true, 
    "MetaData": {
        "CreateTime": "2014-09-22T18:49:43-07:00", 
        "LastUpdatedTime": "2014-09-22T18:49:44-07:00"
    }, 
    "BillAddr": {
        "City": "city 1", 
        "Country": "USA", 
        "Line1": "billing address line 1\nbilling address line 2", 
        "PostalCode": "98765", 
        "CountrySubDivisionCode": "ST", 
        "Id": "130"
    }, 
    "MiddleName": "mid", 
    "Active": true, 
    "Balance": 0, 
    "SyncToken": "0", 
    "Suffix": "suf", 
    "CompanyName": "my company name", 
    "ShipAddr": {
        "City": "city 2", 
        "Country": "USA", 
        "Line1": "shipping address line 1\nshipping address line 2", 
        "PostalCode": "54321", 
        "CountrySubDivisionCode": "TS", 
        "Id": "131"
    }, 
    "PrintOnCheckName": "my display name", 
    "sparse": false, 
    "Id": "212"
}

Here's the request body when I do the update (SyncToken matches, sparse is false...):

{
    "domain": "QBO", 
    "DisplayName": "my display name", 
    "Title": "mr.", 
    "PreferredDeliveryMethod": "Print", 
    "GivenName": "first", 
    "FullyQualifiedName": "my display name", 
    "BillWithParent": false, 
    "Job": false, 
    "BalanceWithJobs": 0.0, 
    "Taxable": true, 
    "MetaData": {
        "CreateTime": "2014-09-22T18:49:43-07:00", 
        "LastUpdatedTime": "2014-09-22T18:49:43-07:00"
    }, 
    "sparse": false, 
    "MiddleName": "mid", 
    "Active": true, 
    "Balance": 0.0, 
    "SyncToken": 0, 
    "Suffix": "suf", 
    "CompanyName": "my company name", 
    "FamilyName": "last", 
    "PrintOnCheckName": "my display name", 
    "BillAddr": {
        "CountrySubDivisionCode": "ST", 
        "City": "city 1", 
        "PostalCode": "98765", 
        "Line1": "billing address line 1\nbilling address line 2", 
        "Country": "USA"
    }, 
    "Id": "212"
}

And then when I read it again afterwards, it still has the shipping address (though note the SyncToken has incremented, so the API 'got the message':

{
    "domain": "QBO", 
    "FamilyName": "last", 
    "DisplayName": "my display name", 
    "Title": "mr.", 
    "PreferredDeliveryMethod": "Print", 
    "GivenName": "first", 
    "FullyQualifiedName": "my display name", 
    "BillWithParent": false, 
    "Job": false, 
    "BalanceWithJobs": 0, 
    "Taxable": true, 
    "MetaData": {
        "CreateTime": "2014-09-22T18:49:43-07:00", 
        "LastUpdatedTime": "2014-09-22T18:51:20-07:00"
    }, 
    "BillAddr": {
        "City": "city 1", 
        "Country": "USA", 
        "Line1": "billing address line 1\nbilling address line 2", 
        "PostalCode": "98765", 
        "CountrySubDivisionCode": "ST", 
        "Id": "130"
    }, 
    "MiddleName": "mid", 
    "Active": true, 
    "Balance": 0, 
    "SyncToken": "1", 
    "Suffix": "suf", 
    "CompanyName": "my company name", 
    "ShipAddr": {
        "City": "city 1", 
        "Country": "USA", 
        "Line1": "billing address line 1\nbilling address line 2", 
        "PostalCode": "98765", 
        "CountrySubDivisionCode": "ST", 
        "Id": "130"
    }, 
    "PrintOnCheckName": "my display name", 
    "sparse": false, 
    "Id": "212"
}

I've found that if I just set a SINGLE line of the shipping address (to 'x', for example, then the change goes through, but what I'm trying above (which is what I really want—to DELETE the shipping address), has failed. I don't see it on the known issues list, but I know that when a friend of mine recently migrated from QuickBooks Desktop to QuickBooks Online, shipping addresses were populated where previously there was just a billing address.

Anyone know how to achieve this?

Thanks!

1
Do a read call and then try to update using full payload. Send the metadata info also. Let me know if that works.nimisha shrivastava
You might also want to check this -stackoverflow.com/questions/24038662/… if you are using dotnet sdk.nimisha shrivastava
It doesn't work. I'm trying it all in the API Explorer. I do a read, I copy and paste the inner object dictionary from the response into the update box (which already has spare = false), delete the ShipAddr dict, and the response still shows the shipping address.HaPsantran

1 Answers

0
votes

UPDATE Adding working JSON example.

{
  "Customer": {
    "Taxable": false,
    "BillAddr": {
      "Id": "9",
      "Line1": "100 Street",
      "City": "Bangalore",
      "Country": "India",
      "CountrySubDivisionCode": "Karnataka",
      "PostalCode": "560103"
    },
    "ShipAddr": {
      "Id": "9",
      "Line1": "100 Street",
      "City": "Bangalore",
      "Country": "India",
      "CountrySubDivisionCode": "Karnataka",
      "PostalCode": "560103"
    },
    "Job": false,
    "BillWithParent": false,
    "Balance": 0,
    "BalanceWithJobs": 0,
    "PreferredDeliveryMethod": "Email",
    "domain": "QBO",
    "sparse": false,
    "Id": "16",
    "SyncToken": "0",
    "MetaData": {
      "CreateTime": "2014-09-22T21:54:13-07:00",
      "LastUpdatedTime": "2014-09-22T21:54:13-07:00"
    },
    "GivenName": "AA",
    "FullyQualifiedName": "AA",
    "DisplayName": "AA",
    "PrintOnCheckName": "AA",
    "Active": true
  },
  "time": "2014-09-22T21:55:17.28-07:00"
}

Update Request

{
    "Taxable": false,
    "BillAddr": {
      "Id": "9",
      "Line1": "100 Street",
      "City": "Bangalore",
      "Country": "India",
      "CountrySubDivisionCode": "Karnataka",
      "PostalCode": "560103"
    },
    "Job": false,
    "BillWithParent": false,
    "Balance": 0,
    "BalanceWithJobs": 0,
    "PreferredDeliveryMethod": "Email",
    "domain": "QBO",
    "sparse": false,
    "Id": "16",
    "SyncToken": "0",
    "MetaData": {
      "CreateTime": "2014-09-22T21:54:13-07:00",
      "LastUpdatedTime": "2014-09-22T21:54:13-07:00"
    },
    "GivenName": "AA",
    "FullyQualifiedName": "AA",
    "DisplayName": "AA",
    "PrintOnCheckName": "AA",
    "Active": true
}

Get By Id

{
  "Customer": {
    "Taxable": false,
    "BillAddr": {
      "Id": "9",
      "Line1": "100 Street",
      "City": "Bangalore",
      "Country": "India",
      "CountrySubDivisionCode": "Karnataka",
      "PostalCode": "560103"
    },
    "Job": false,
    "BillWithParent": false,
    "Balance": 0,
    "BalanceWithJobs": 0,
    "PreferredDeliveryMethod": "Email",
    "domain": "QBO",
    "sparse": false,
    "Id": "16",
    "SyncToken": "1",
    "MetaData": {
      "CreateTime": "2014-09-22T21:54:13-07:00",
      "LastUpdatedTime": "2014-09-22T21:56:21-07:00"
    },
    "GivenName": "AA",
    "FullyQualifiedName": "AA",
    "DisplayName": "AA",
    "PrintOnCheckName": "AA",
    "Active": true
  },
  "time": "2014-09-22T21:56:49.814-07:00"
}

Did you try XML payload. It worked fine for me. PFB below request/response. I'll verify the JSON way and update this post.

<Customer xmlns="http://schema.intuit.com/finance/v3" domain="QBO" sparse="false">
            <Id>14</Id>
            <SyncToken>0</SyncToken>
            <MetaData>
                <CreateTime>2014-09-22T21:04:02-07:00</CreateTime>
                <LastUpdatedTime>2014-09-22T21:04:02-07:00</LastUpdatedTime>
            </MetaData>
            <GivenName>Neo</GivenName>
            <FamilyName>Light</FamilyName>
            <FullyQualifiedName>Neo Light</FullyQualifiedName>
            <CompanyName>ABC</CompanyName>
            <DisplayName>Neo Light</DisplayName>
            <PrintOnCheckName>Neo Light</PrintOnCheckName>
            <Active>true</Active>
            <PrimaryEmailAddr>
                <Address>[email protected]</Address>
            </PrimaryEmailAddr>
            <Taxable>false</Taxable>
            <BillAddr>
                <Id>7</Id>
                <Line1>ABC Street</Line1>
                <City>Bangalore</City>
                <Country>India</Country>
                <CountrySubDivisionCode>Karnataka</CountrySubDivisionCode>
                <PostalCode>560103</PostalCode>
            </BillAddr>
            <ShipAddr>
                <Id>7</Id>
                <Line1>ABC Street</Line1>
                <City>Bangalore</City>
                <Country>India</Country>
                <CountrySubDivisionCode>Karnataka</CountrySubDivisionCode>
                <PostalCode>560103</PostalCode>
            </ShipAddr>
            <Job>false</Job>
            <BillWithParent>false</BillWithParent>
            <Balance>0</Balance>
            <BalanceWithJobs>0</BalanceWithJobs>
            <PreferredDeliveryMethod>Email</PreferredDeliveryMethod>
        </Customer>

Update request

<Customer xmlns="http://schema.intuit.com/finance/v3" domain="QBO" sparse="false">
    <Id>14</Id>
    <SyncToken>0</SyncToken>
    <MetaData>
        <CreateTime>2014-09-22T21:04:02-07:00</CreateTime>
        <LastUpdatedTime>2014-09-22T21:04:02-07:00</LastUpdatedTime>
    </MetaData>
    <GivenName>Neo</GivenName>
    <FamilyName>Light</FamilyName>
    <FullyQualifiedName>Neo Light</FullyQualifiedName>
    <CompanyName>ABC</CompanyName>
    <DisplayName>Neo Light</DisplayName>
    <PrintOnCheckName>Neo Light1</PrintOnCheckName>
    <Active>true</Active>
    <PrimaryEmailAddr>
        <Address>[email protected]</Address>
    </PrimaryEmailAddr>
    <Taxable>false</Taxable>
    <BillAddr>
        <Id>7</Id>
        <Line1>ABC Street</Line1>
        <City>Bangalore</City>
        <Country>India</Country>
        <CountrySubDivisionCode>Karnataka</CountrySubDivisionCode>
        <PostalCode>560103</PostalCode>
    </BillAddr>
    <Job>false</Job>
    <BillWithParent>false</BillWithParent>
    <Balance>0</Balance>
    <BalanceWithJobs>0</BalanceWithJobs>
    <PreferredDeliveryMethod>Email</PreferredDeliveryMethod>
</Customer>

Verified that 'shipAddr' is not present anymore

<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-09-22T21:07:31.919-07:00">
  <Customer domain="QBO" sparse="false">
    <Id>14</Id>
    <SyncToken>1</SyncToken>
    <MetaData>
      <CreateTime>2014-09-22T21:04:02-07:00</CreateTime>
      <LastUpdatedTime>2014-09-22T21:06:58-07:00</LastUpdatedTime>
    </MetaData>
    <GivenName>Neo</GivenName>
    <FamilyName>Light</FamilyName>
    <FullyQualifiedName>Neo Light</FullyQualifiedName>
    <CompanyName>ABC</CompanyName>
    <DisplayName>Neo Light</DisplayName>
    <PrintOnCheckName>Neo Light1</PrintOnCheckName>
    <Active>true</Active>
    <PrimaryEmailAddr>
      <Address>[email protected]</Address>
    </PrimaryEmailAddr>
    <Taxable>false</Taxable>
    <BillAddr>
      <Id>7</Id>
      <Line1>ABC Street</Line1>
      <City>Bangalore</City>
      <Country>India</Country>
      <CountrySubDivisionCode>Karnataka</CountrySubDivisionCode>
      <PostalCode>560103</PostalCode>
    </BillAddr>
    <Job>false</Job>
    <BillWithParent>false</BillWithParent>
    <Balance>0</Balance>
    <BalanceWithJobs>0</BalanceWithJobs>
    <PreferredDeliveryMethod>Email</PreferredDeliveryMethod>
  </Customer>
</IntuitResponse>

Thanks