QBO API V3 Sparse update request to reactivate entity in named list - intuit-partner-platform

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

Related

Twinfield every SOAP request failed

Before this project I never worked with SOAP. So I followed all of the instructions from: https://wktaaeu.force.com/nlcommunity/s/article/Setting-up-OAuth-2-0-Introduction?language=en_US and used the Postman templates on that page to make SOAP requests.
After a while I got the Access Token and company code, but I can't find out how to make other requests. With every request that I try to make from different sources on the internet I get the following error:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server was unable to process request. ---> Object reference not set to an instance of an object.</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
Im making a mistake why every request fails but I can't figure it out.
Examples of different requests I tried
This one I took from: Postman Twinfield API request deleted transactions
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:Authentication xmlns:h="http://www.twinfield.com/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<AccessToken xmlns="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.Shared">ACCESS_TOKEN</AccessToken>
<CompanyCode xmlns="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.Shared">35f3248f-46cc-4a8e-b16c-69ac65118771</CompanyCode>
</h:Authentication>
</s:Header>
<s:Body>
<Query i:type="b:GetDeletedTransactions" xmlns="http://www.twinfield.com/" xmlns:a="http://schemas.datacontract.org/2004/07/Twinfield.WebServices" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:b="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.DeletedTransactionsService">
<b:CompanyCode>COMPANY_CODE</b:CompanyCode>
<b:DateFrom>2022-01-01T00:00:00</b:DateFrom>
<b:DateTo>2022-12-31T23:59:00</b:DateTo>
<b:Daybook></b:Daybook>
</Query>
</s:Body>
</s:Envelope>
Second try was by myself from the docs:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:twin="http://www.twinfield.com/">
<soapenv:Header>
<twin:Header>
<twin:AccessToken>ACCESS_TOKEN</twin:AccessToken>
</twin:Header>
</soapenv:Header>
<soapenv:Body>
<twin:ProcessXmlString>
<twin:xmlRequest><![CDATA[<list><type>offices</type></list>]]></twin:xmlRequest>
</twin:ProcessXmlString>
</soapenv:Body>
</soapenv:Envelope>
Last one also made by my reading the docs:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:twinfield="http://www.twinfield.com/">
<soap:Header>
<twinfield:Header>
<twinfield:AccessToken>ACCESS_TOKEN</twinfield:AccessToken>
<twinfield:CompanyCode>COMPANY_CODE</twinfield:CompanyCode>
</twinfield:Header>
</soap:Header>
<soap:Body>
<twinfield:ProcessXmlDocument>
<twinfield:xmlRequest>
<read>
<type>dimensions</type>
<office>COMPANY_CODE</office>
<dimtype>SALARIS</dimtype>
<code>1234</code>
</read>
</twinfield:xmlRequest>
</twinfield:ProcessXmlDocument>
</soap:Body>
</soap:Envelope>
I'v had the same struggle as you are going through, after a while I contacted Twinfield about this and they offered me a slightly different soap xml, this is no where explained nor noted down but it worked so maybe it will work for you as well:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:Authentication xmlns:h="http://www.twinfield.com/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<AccessToken xmlns="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.Shared">{{Accescode}}</AccessToken>
<CompanyCode xmlns="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.Shared">{{Company}}</CompanyCode>
</h:Authentication>
</s:Header>
<s:Body>
<Query i:type="b:GetDeletedTransactions" xmlns="http://www.twinfield.com/" xmlns:a="http://schemas.datacontract.org/2004/07/Twinfield.WebServices" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:b="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.DeletedTransactionsService">
<b:CompanyCode>{{Company}}</b:CompanyCode>
<b:DateFrom>2022-06-01T00:00:00</b:DateFrom>
<b:DateTo>2022-07-30T23:59:00</b:DateTo>
<b:Daybook></b:Daybook>
</Query>
</s:Body>
</s:Envelope>
As you can see there a few parameters that you need to set the "Company" and the "Access code"
for the company list I've been using this xml request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:twin="http://www.twinfield.com/">
<soapenv:Header>
<twin:Header>
<twin:AccessToken>{{Accescode}}</twin:AccessToken>
</twin:Header>
</soapenv:Header>
<soapenv:Body>
<twin:ProcessXmlString>
<twin:xmlRequest><![CDATA[<list><type>offices</type></list>]]></twin:xmlRequest>
</twin:ProcessXmlString>
</soapenv:Body>
</soapenv:Envelope>
if these dont work it might be that your licence within the twinfield environment needs to be adjusted so you've access to this.

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>

SOAP Object reference not set to an instance of an object

I'm attempting to run a search for a ticket on ChangeGear 5.0. Their API utilizes SOAP requests, and when I run a request to search I get the error "Object reference not set to an instance of an object". I've looked through existing topics concerning the same issue (there are a lot of them), and I've tried all of them with no luck. Non-required parameters are included as empty tags instead of omitted entirely, I've tried capitalizing the names of the parameters, and I've made sure the request is formatted appropriately according to the WSDL.
The provided ChangeGear 5.0 documentation specifies to structure requests like so:
POST /cgweb/cgwebservices/cgwebservices.asmx HTTP/1.1
Host: ...
Content-Type: application/soap+xml; charset=utf-8
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Search xmlns="http://www.sunviewsoftware.com/CGWebServices/">
<sessionId>string</sessionId>
<entityType>string</entityType>
<criteria>string</criteria>
<retrieveRelated>boolean</retrieveRelated>
<entityTemplate>string</entityTemplate>
</Search>
</soap12:Body>
</soap12:Envelope>
This is the request I'm POSTing with the specified headers:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Search xmlns="http://www.sunviewsoftware.com/CGWebServices/">
<sessionId></sessionId>
<entityType></entityType>
<criteria></criteria>
<retrieveRelated>true</retrieveRelated>
<entityTemplate></entityTemplate>
</Search>
</soap12:Body>
</soap12:Envelope>
The only parameter I've set is retrieveRelated because as specified by the WSDL it is the only required parameter, but I've also tried setting all the string parameters to arbitrary non-null values and received the same result. I'm sure the API is functional because when I use the login operation it returns successfully:
POST /cgweb/cgwebservices/cgwebservices.asmx HTTP/1.1
Host: ...
Content-Type: application/soap+xml; charset=utf-8
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Login xmlns="http://www.sunviewsoftware.com/CGWebServices/">
<userName>...</userName>
<password>...</password>
</Login>
</soap12:Body>
</soap12:Envelope>
Result:
200 OK
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<LoginResponse xmlns="http://www.sunviewsoftware.com/CGWebServices/">
<LoginResult>...</LoginResult>
</LoginResponse>
</soap:Body>
</soap:Envelope>
I am using the same session I used for the login operation. Is there anything else I can try besides including empty tags for omitted parameters or capitalizing their names? The full error is:
500 Internal Server Error
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Receiver</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">Object reference not set to an instance of an object.</soap:Text>
</soap:Reason>
<soap:Node>.../cgweb/cgwebservices/cgwebservices.asmx</soap:Node>
<detail>
<Error xmlns=".../cgweb/cgwebservices/cgwebservices.asmx">
<ErrorNumber>0</ErrorNumber>
<ErrorMessage/>
<ErrorCode>L_REJECT_CHANGES_FAILED</ErrorCode>
</Error>
<Error xmlns=".../cgweb/cgwebservices/cgwebservices.asmx">
<ErrorNumber>0</ErrorNumber>
<ErrorMessage>Object reference not set to an instance of an object.</ErrorMessage>
<ErrorCode>Object reference not set to an instance of an object.</ErrorCode>
</Error>
<Error xmlns=".../cgweb/cgwebservices/cgwebservices.asmx">
<ErrorNumber>0</ErrorNumber>
<ErrorMessage>Object reference not set to an instance of an object.</ErrorMessage>
<ErrorCode/>
</Error>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
The problem was that the server wasn't adhering to the WSDL. The entityTemplate parameter was required, and without it the server returns the "Object reference not set to an instance of an object" error. When I initially tested the parameters with dummy values, out of coincidence I had accidentally forgot to set this one -- the only one that strayed from the WSDL specification.

Batch Operations API V3 - blank response

Here is a sample of a bacth operation request:
<?xml version='1.0' encoding='UTF-8'?>
<IntuitBatchRequest xmlns="http://schema.intuit.com/finance/v3" >
<BatchItem operation="sparse" bId="bid1">
<Invoice>
<Id>183</Id>
<SyncToken>4</SyncToken>
<SalesTermRef>5</SalesTermRef>
</Invoice>
</BatchItem>
</IntuitBatchRequest>
I get a blank response and the invoice is not updated.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-11-26T09:45:12.812-08:00"/>
Any ideas ?
Thanks

NSXMLParser error code 201

I have an xml data called
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfflineDealModel>
<DealUri>http://www.upto75.com/Therapy_Ayurveda/m/5505/Sale_Offer.html</DealUri>
<DealCode i:nil="true"/>
</OfflineDealModel>
When I am parsing this data I am getting the error code called 201 at the line <DealCode i:nil="true"/>.Kindly help me how to solve this.Let me know if you need any more details.
It seems to be your tag not closed properly.
<DealCode i:nil="true">
</DealCode>
you need to add xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
Just Try This :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfflineDealModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<DealUri>http://www.upto75.com/Therapy_Ayurveda/m/5505/Sale_Offer.html</DealUri>
<DealCode i:nil="true" />
</OfflineDealModel>
may be its work