How to retrieve the job and customer suffix field using the quickbooks API - intuit-partner-platform

We are building an application that gets data from a QuickBooks online account using the QuickBooks Online API V2. According to the API documentation, we can see that the "Suffix" field is supported for both customer and job tables. However we have noticed this field is not being returned in the API response. Below is a sample response for a job which should have a suffix (the suffix is present in the quickbooks UI). Is this a problem with the API, the API documentation, or our API request?
200
14
2013-05-08T10:57:55-07:00
2013-09-17T09:23:39-07:00
Bridget O'Brien276
5165 easy
Line 2
Line 3
Line 4
Line 5
Portland
United States
OR
12620
INVALID
Billing
Primary
555-5837
Fax
555-5838
Mobile
555-556-9176
http://www.customersruscorp.com
QBOrocksTest#yahoo.com
Bridget
Elizabeth
O'Brien276
CustomersRus LLC
This is a note.
Bill With Parent
true
Preferred Delivery Method
PRINT
Bridget O'Brien276
2
1
IS_TAXABLE
2
12
3
Bridget O'Brien

Just now I've created a customer using IDS V2 API.
Req body -
<?xml version="1.0" encoding="utf-8"?>
<Customer xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://www.intuit.com/sb/cdm/v2">
<TypeOf>Person</TypeOf>
<Name>John Doe</Name>
<Suffix>Sr</Suffix>
</Customer>
Response (GetByID) -
<Customer xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
<Id idDomain="QBO">6</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-09-19T15:53:47-07:00</CreateTime>
<LastUpdatedTime>2013-09-19T15:53:47-07:00</LastUpdatedTime>
</MetaData>
<Name>John Doe</Name>
<WebSite />
<Email />
<Suffix>Sr</Suffix>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="StringTypeCustomField">
<DefinitionId>Preferred Delivery Method</DefinitionId>
<Value>DONT</Value>
</CustomField>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="StringTypeCustomField">
<DefinitionId>Resale Number</DefinitionId>
</CustomField>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="BooleanTypeCustomField">
<DefinitionId>Bill With Parent</DefinitionId>
<Value>false</Value>
</CustomField>
<ShowAs>John Doe</ShowAs>
<OpenBalance>
<Amount>0</Amount>
</OpenBalance>
</Customer>
It seems, it works in GetByID API call.
Edit
But GetAll query endpoint doesn't populate suffix attribute. Here is the response.
<Customer>
<Id idDomain="QBO">6</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-09-19T15:53:47-07:00</CreateTime>
<LastUpdatedTime>2013-09-19T15:53:47-07:00</LastUpdatedTime>
</MetaData>
<Name>John Doe</Name>
<WebSite />
<Email />
<CustomField xsi:type="BooleanTypeCustomField">
<DefinitionId>Bill With Parent</DefinitionId>
<Value>false</Value>
</CustomField>
<CustomField xsi:type="StringTypeCustomField">
<DefinitionId>Preferred Delivery Method</DefinitionId>
<Value>DONT</Value>
</CustomField>
<ShowAs>John Doe</ShowAs>
<OpenBalance>
<Amount>0</Amount>
</OpenBalance>
</Customer>
Thanks

Related

How to create sales order in Netsuite using SOAP API with TBA credentials?

I have spent more time on creating Sales order in Netsuite using SOAP API with SOAP API. I have tried the following payload and getting error message as Invalid SOAPAction header: get
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<ns1:preferences xmlns:ns1="urn:messages_2017_2.platform.webservices.netsuite.com">
<ns1:warningAsError>false</ns1:warningAsError>
<ns1:ignoreReadOnlyFields>true</ns1:ignoreReadOnlyFields>
</ns1:preferences>
<ns2:tokenPassport soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns2="urn:messages_2017_2.platform.webservices.netsuite.com">
<ns3:account xmlns:ns3="urn:core_2017_2.platform.webservices.netsuite.com">{{account}}</ns3:account>
<ns3:consumerKey xmlns:ns3="urn:core_2017_2.platform.webservices.netsuite.com">{{consumerKey}}</ns3:consumerKey>
<ns3:token xmlns:ns3="urn:core_2017_2.platform.webservices.netsuite.com">{{tokenId}}</ns3:token>
<ns3:nonce xmlns:ns3="urn:core_2017_2.platform.webservices.netsuite.com">{{nonce}}</ns3:nonce>
<ns3:signature algorithm="HMAC-SHA256" xmlns:ns3="urn:core_2017_2.platform.webservices.netsuite.com">{{signature}}</ns3:signature>
</ns2:tokenPassport>
</soapenv:Header>
<soapenv:Body>
<add xmlns="urn:messages_2017_2.platform.webservices.netsuite.com">
<record xsi:type="ns4:SalesOrder" xmlns:ns4="urn:sales_2017_2.transactions.webservices.netsuite.com">
<ns4:entity internalId="1655 customer" xsi:type="ns5:RecordRef"
xmlns:ns5="urn:core_2017_2.platform.webservices.netsuite.com">
<ns5:name xsi:type="xsd:string">LAZADA-SG1</ns5:name>
</ns4:entity>
<ns4:tranDate xsi:type="xsd:dateTime">2017-12-14T18:16:44.000Z</ns4:tranDate>
<ns4:shipAddressList internalId="84" xsi:type="ns6:RecordRef"
xmlns:ns6="urn:core_2017_2.platform.webservices.netsuite.com"/>
<ns4:itemList replaceAll="true" xsi:type="ns4:SalesOrderItemList">
<ns4:item xsi:type="ns4:SalesOrderItem">
<ns4:item internalId="387 inventoryItem" xsi:type="ns7:RecordRef"
xmlns:ns7="urn:core_2017_2.platform.webservices.netsuite.com"/>
<ns4:quantity xsi:type="xsd:double">2.0</ns4:quantity>
</ns4:item>
</ns4:itemList>
</record>
</add>
</soapenv:Body>
</soapenv:Envelope>
Also, I have tried different versions.
Can someone help to share the sample SOAP XML payload to create Sales order in netsuite?
It's working
Here I have got the payload to POST the sales order successfully in Netsuite with basic details
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<preferences xmlns="urn:messages_2020_1.platform.webservices.netsuite.com">
<warningAsError>false</warningAsError>
<ignoreReadOnlyFields>true</ignoreReadOnlyFields>
</preferences>
<tokenPassport xsi:type="TokenPassport">
<account>{{account}}</account>
<consumerKey>{{consumerKey}}</consumerKey>
<token>{{tokenId}}</token>
<nonce>{{nonce}}</nonce>
<timestamp>{{timestamp}}</timestamp>
<signature algorithm="HMAC-SHA256">{{signature}}=</signature>
</tokenPassport>
</soap:Header>
<soap:Body>
<add>
<record xsi:type="tranSales:SalesOrder" xmlns:tranSales="urn:sales_2020_1.transactions.webservices.netsuite.com">
<entity internalId="1655"/>
<itemList>
<item>
<item internalId="387"/>
<quantity>3</quantity>
<amount>45.3</amount>
</item>
</itemList>
</record>
</add>
</soap:Body>
</soap:Envelope>

QBO API V3 Sparse update request to reactivate entity in named list

According to the Accounting API docs named lists items are soft deleted, so it is possible to reactivate them with a sparse update where Active is set to true. This is working fine for Term, Account, PaymentMethod, and Department.
However we ran into issues when trying to sparse update Class and TaxCode. Here are the request/response we got in each case:
<?xml version="1.0" encoding="UTF-8"?>
<Class xmlns="http://schema.intuit.com/finance/v3" sparse="true">
<Id>5000000000000020362</Id>
<Name>Consultancy (deleted)</Name>
<SyncToken>1</SyncToken>
<Active>true</Active>
</Class>
Response from request to sparse update to reactivate class:
<?xml version="1.0" encoding="UTF-8"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2016-12-29T10:36:51.732-08:00">
<Fault type="ValidationFault">
<Error code="6000" element="">
<Message>A business validation error has occurred while processing your request</Message>
<Detail>Business Validation Error: You cannot modify a list element that has been deleted.</Detail>
</Error>
</Fault>
</IntuitResponse>
Request to activate a tax code
<?xml version="1.0" encoding="UTF-8"?>
<TaxCode xmlns="http://schema.intuit.com/finance/v3" sparse="true">
<Id>4</Id>
<Name>California - Inactive</Name>
<SyncToken>1</SyncToken>
<Active>true</Active>
</TaxCode>
Response from request to sparse update to reactivate tax code:
<?xml version="1.0" encoding="UTF-8"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2016-12-30T14:20:24.614-08:00">
<Fault type="ValidationFault">
<Error code="500" element="Operation">
<Message>Unsupported Operation</Message>
<Detail>Operation Update is not supported.</Detail>
</Error>
</Fault>
</IntuitResponse>
Any help would be much appreciated.
Thanks,
Fernando

Access a web-service with session-key/token from WSO2 ESB

I'm starting to evaluate WSO2 ESB and try to implement some simple but real life scenarios.
What I'm trying to do, in this specific case is connect to a web-service that uses a session-key in the payload to do the authentication. So there is one web-service call with user and password to get the key and then I need to put this into the payload of the second web-service call to actually retrieve data from a service.
I don't want to log in with every service call, for performance reasons, but log in once, store the key for some time and do a couple of requests.
The service I want to call is a SugarCRM web-service.
The login message would be something like this:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<sug:login soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<user_auth xsi:type="sug:user_auth">
<user_name xsi:type="xsd:string">interface</user_name>
<password xsi:type="xsd:string">MD5HASHOFPASSWORD</password>
</user_auth>
<application_name xsd:string">dummy</application_name>
<name_value_list xsi:type="sug:name_value_list" soapenc:arrayType="sug:name_value[]"/>
</sug:login>
</soapenv:Body>
Which returns something like this:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.sugarcrm.com/sugarcrm">
<SOAP-ENV:Body>
<ns1:loginResponse xmlns:ns1="http://www.sugarcrm.com/sugarcrm">
<return xsi:type="tns:entry_value">
<id xsi:type="xsd:string">loggfi0i3j6eeugs7l0a0m2587</id>
</return>
</ns1:loginResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Then I need to use the "id" field as the token for a new request.
Example, to request all the Leads (the "id" is put into the "session" field):
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<sug:get_entry_list soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<session xsi:type="xsd:string">loggfi0i3j6eeugs7l0a0m2587</session>
<module_name xsi:type="xsd:string">Leads</module_name>
</sug:get_entry_list>
</soapenv:Body>
</soapenv:Envelope>
This request then returns all the Leads in the database.
Equally this is needed for accessing web-services that use OAuth2, for example the REST-API of MS Dynamics CRM, only then I need to put the token/bearer in the header.
How would I go about realizing the above scenario in WSO2 ESB? I'm sure this is pretty common, but I have not found documentation or examples for it.
Here is the sequence to get the session-id from the CRM:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="sugar_login" trace="enable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
<format>
<sug:login xmlns:sug="http://www.sugarcrm.com/sugarcrm">
<sug:user_auth>
<user_name>interface</user_name>
<password>MD5HASHOFPASSWORD</password>
<version>1</version>
</sug:user_auth>
<application_name>dummy</application_name>
</sug:login>
</format>
</payloadFactory>
<header name="To" value="http://my.sugarcrm.com:9090/service/v4_1/soap.php"/>
<call>
<endpoint name="templEPTimeout" template="org.wso2.carbon.connector.sugarcrm.timeout">
<axis2ns653:parameter name="timoutDuration" value="6000" xmlns:axis2ns653="http://ws.apache.org/ns/synapse"/>
<axis2ns654:parameter name="maximumDuration" value="3000" xmlns:axis2ns654="http://ws.apache.org/ns/synapse"/>
<axis2ns655:parameter name="progressAFactor" value="2.0" xmlns:axis2ns655="http://ws.apache.org/ns/synapse"/>
<axis2ns656:parameter name="initialDuration" value="2000" xmlns:axis2ns656="http://ws.apache.org/ns/synapse"/>
</endpoint>
</call>
<!-- Remove response custom header information -->
<header action="remove" name="X-SOAP-Server" scope="transport"/>
<header action="remove" name="Cache-control" scope="transport"/>
<header action="remove" name="Vary" scope="transport"/>
<header action="remove" name="Expires" scope="transport"/>
<header action="remove" name="Set-Cookie" scope="transport"/>
<header action="remove" name="path" scope="transport"/>
<property expression="//ns1:loginResponse/return/id"
name="sugarsessionid" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
</sequence>
You can use the sugarcrm connector to connect with SugarCRM API. You can find the sugarcrm connector at WSO2 Store. Find more details in the documentation.

Confusion regarding passing a SOAP related XML request:

I have the following message available in the WSDL:
<message name="checklookupRequest">
<part name="mobileNumber" type="xsd:string" />
<part name="userName" type="xsd:string" />
<part name="password" type="xsd:string" />
</message>
I have created the following request inside the body tag of coldfusion page:
<cfsavecontent variable="soapBody">
<cfoutput>
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:p1 = "https://abcd/checkLookup.php?wsdl" >
<soap:Header>
</soap:Header>
<soap:Body>
<p1:checklookupRequest>
<phonenumber>4135671234</phonenumber>
<username>test</username>
<password>password</password>
</p1:checklookupRequest>
</soap:Body>
</soap:Envelope>
</cfoutput>
</cfsavecontent>
My question is that, I am using username and password in the cfhttp tag as well. So, it seems like I am bound to send username and password as a part of message invocation and as a part of cfhttp requirements. Please correct me if I am wrong.
Thanks
P.S: I don't have any Web API documentation available for the Web Service I am using.

How to read some element name from XML using GData library?

I am making an app in which I am using SOAP web service, I am receiving this data -
<?xml version="1.0" encoding="UTF-8"?>
<User xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.myurl.com/">
<code>200</code>
<profile>
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<id>1</id>
<country>Afghanistan</country>
<isd_code>93</isd_code>
<timezone>+04:30</timezone>
<visible>false</visible>
</Table>
</NewDataSet>
</profile>
</User>
And I am using GData library to read this data. I am able to read <NewDataSet> element values but don't know how to read value of <code> tag. So please suggest me to do this.