我正在使用Intuit Partner Platform v3 QBO API尝试更新a Customer object。本文的唯一目的是删除送货地址。
这是在更改之前查询的原始对象:
{
"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"
}
这是我更新时的请求正文(SyncToken匹配,稀疏是假...):
{
"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"
}
然后当我再次阅读它时,它仍然有发货地址(虽然注意到SyncToken已经递增,所以API'得到了消息':
{
"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"
}
我发现,如果我只设置一个发货地址的SINGLE行(例如,'x',则更改会通过,但我正在尝试上面(这是我真正想要的)删除发货地址),失败了。我没有在known issues list上看到它,但我知道当我的一个朋友最近从QuickBooks Desktop迁移到QuickBooks Online时,发货地址填充在以前只有帐单邮寄地址。
任何人都知道如何实现这一目标?
谢谢!
答案 0 :(得分:0)
更新添加工作JSON示例。
{
"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"
}
更新请求
{
"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
}
{
"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"
}
您是否尝试过XML有效负载?它对我来说很好。 PFB低于请求/响应。 我将验证JSON方式并更新此帖子。
<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>abc@abc.co.in</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>
更新请求
<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>abc@abc.co.in</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>
已验证&#39; shipAddr&#39;不再存在
<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>abc@abc.co.in</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>
由于