ValidationError when sparse updating a Payment trying to specify new LinkedTxn lines - intuit-partner-platform

I am trying to perform a sparse update on a QuickBooks Online Payment object using the .NET SDK. For some reason as soon as I try to specify a <Line> element in the update request, I get a ValidationError requiring a CustomerRef.
Request:
<?xml version="1.0"?>
<Payment xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" sparse="true" xmlns="http://schema.intuit.com/finance/v3">
<Id>1060</Id>
<SyncToken>3</SyncToken>
<TxnDate>2014-11-25</TxnDate>
<PrivateNote />
<Line>
<Amount>390.0000</Amount>
<LinkedTxn>
<TxnId>1308</TxnId>
<TxnType>Invoice</TxnType>
</LinkedTxn>
</Line>
<TotalAmt>390.0000</TotalAmt>
</Payment>
Response:
{"Fault": {
"Error": [{
"Message":"Required param missing, need to supply the required value for the API",
"Detail":"Required parameter CustomerRef is missing in the request",
"code":"2020",
"element":"Payment"}],
"type":"ValidationFault"},
"time":"2015-01-20T07:20:15.191-08:00"}
I thought a sparse update meant that anything you did not specify stayed the same as the original entity. I can't see anything that says one way or the other in the documentation. Do I need to fetch the CustomerRef from the current entity to feed it back to the API and keep it happy, or am I just doing something wrong?

Although this is Sparse update but I believe the customerref is required, as a 'validation check for Customer' is needed when you send the Update request. This check is needed to verify that CustomerRef for Updated payment is same as the Invoice's CustomerRef. So, you should send it in your request.

Related

How to get purchase order documents from tradeShift API?

I am trying to get the trade shift purchase order using their API.
FYI, While I am making an API request,
I am using OAuth1.
I am using endpoint
https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents?limit=5
In the header, When I set Accept as application/JSON, I am getting a response like
{
"itemsPerPage": 5,
"itemCount": 2,
"indexing": false,
"numPages": 1,
"pageId": 0,
"Document": []
}
But If I add nothing in the Header, I am getting an XML response.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ts:DocumentList xmlns:cec="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ts="http://tradeshift.com/api/public/1.0" xmlns:ns6="http://tradeshift.com/api/1.0" xmlns:ns7="http://tradeshift.com/api/2.0" xmlns:ns8="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:ns9="urn:oasis:names:specification:ubl:schema:xsd:Quotation-2" xmlns:ns10="urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2" xmlns:ns11="urn:oasis:names:specification:ubl:schema:xsd:Order-2" xmlns:ns12="urn:oasis:names:specification:ubl:schema:xsd:OrderChange-2" xmlns:ns13="urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2" xmlns:ns14="urn:oasis:names:specification:ubl:schema:xsd:Reminder-2" xmlns:ns15="urn:oasis:names:specification:ubl:schema:xsd:RemittanceAdvice-2" xmlns:ns16="urn:oasis:names:specification:ubl:schema:xsd:ReceiptAdvice-2" xmlns:ns17="urn:oasis:names:specification:ubl:schema:xsd:Catalogue-2" xmlns:ns18="https://tradeshift.com/documents/ubl/xsd/Requisition-2" xmlns:ns19="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2" xmlns:ns20="urn:oasis:names:specification:ubl:schema:xsd:RequestForQuotation-2" xmlns:ns21="urn:oasis:names:specification:ubl:schema:xsd:OrderResponseSimple-2" xmlns:ns22="urn:oasis:names:specification:ubl:schema:xsd:OrderCancellation-2" xmlns:ns23="urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2" indexing="false" numPages="1" pageId="0" itemsPerPage="5" itemCount="2"/>
I am not quite sure if the document is already there as UBL format.
Can you please ensure, if the document is already there as UBL.
If document is there, then How can I parse the document?
And if the document is not there, how can I get the documents?
The document is not there, that both responses are the same just the format is different.
In order to get the Documents that you receive in your Tradeshift account you should follow the below steps:
get the list with all the documents available in your account using the below API:
GET https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents?type=order Content-Type=application/json Accept=application/json Authorisation=oauth1
As response, you will have a JSON with all the orders in your account and the details you will need to retrieve the UBL file of the order.
From the JSON resulted in point 1 using the DocumentId of the order you want to get make the below call
GET https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents/{DocumentUUID} Content-Type=application/json Accept=application/xml Authorisation=oauth1
Once you get a file in order to get it marked as processed you can also tag the document using the below API call:
PUT https://api.tradeshift.com/tradeshift/rest/external/documents/{DocumentId}/tags/{your-tag}
At the first call, you can then add more parameters like withouttag in order to filter out the documents you have tagged already, like in the below call:
`GET https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents?type=order&withouttag={your-tag}`

LogRhythm SOAP Api problems

Anyone here manage to get something from LR soap API ?
My query is quite simple, here is an extract:
<soap:Body>
<GetAlarmHistoryByID
xmlns="http://www.logrhythm.com/webservices"
xmlns:ns2="http://schemas.microsoft.com/2003/10/Serialization/Arrays"
xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/">
<alarmID>140</alarmID>
<includeNotifications>false</includeNotifications>
<includeComments>false</includeComments>
</GetAlarmHistoryByID>
</soap:Body>
I receive the following in response, which makes no sense, because of "Include notifcations or include comments is required." but the values are found lower:
includeNotifications: 140 include comments: False (inversed from the values i passed...)
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring xml:lang="en-US">Include notifcations or include comments is required.</faultstring>
<detail>
<LogRhythmWebServiceFault
xmlns="http://www.logrhythm.com/webservices"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<FaultID>4d12a9ed-bff7-4dfb-ad71-29372c12544d</FaultID>
<Details>Error getting Alarm history (includeNotifications: 140 include comments: False) for ID False</Details>
<FaultTime>2017-09-07T17:46:22.5779477Z</FaultTime>
<ErrorID>3024</ErrorID>
</LogRhythmWebServiceFault>
</detail>
</s:Fault>
Method: GetAlarmHistoryByID
Retrieve a list of alarm status and comment updates. The Alarm ID would be derived from one of the GetFirstPageAlarms or a GetNextPageAlarms method call.
alarmID long No The unique ID of the alarm.
includeNotifications boolean No If true, include notification history.
includeComments boolean No If true, include comments history.
Output
The alarm history.
I had a similar problem and it ended up being a bug with the calls on LogRhythm's side. I'd advise to make a ticket with them for a resolution. If you haven't figured it out yet

Getting the error "Number of packages exceeds maximum" from FedEX API

I am getting "FedEx Ship Error: (8522) Number of packages exceeds maximum" error. I am trying to send a multiple-package shipment request to fedEX, but it is getting failed in first package request only.
For sending multiple shipment request to FedEX, we have to send separate request for each package, the master tracking information will be returned in reply from the first package requested. That master tracking information is then inserted into the requests for each additional package requested for that multiple-package shipment.
The example below is first package request.
Below is the XML request Body I am sending to FedEX API "https://wsbeta.fedex.com:443/xml"
The code is just preparing the data structure, converting it into XML and hitting the fedEX API with XML request.
my $http_request = HTTP::Request->new('POST', $config->{'URL'});
$http_request->content_type('application/x-www-form-urlencoded');
$http_request->content(Encode::encode_utf8($xml_request_body));
my $http_response;
eval {
$http_response = $ua->request($http_request);
};
return errorShipResponse($p) if (!defined $http_response || !$http_response->is_success);
my $response;
eval {
$response = XML::Simple::XMLin(
$http_response->content,
ForceArray => 1,
NSExpand => 1
);
};
$xml_request_body
<?xml version="1.0" encoding="UTF-8"?>
<ProcessShipmentRequest xmlns="http://fedex.com/ws/ship/v12">
<WebAuthenticationDetail>
<UserCredential>
<Key>aaaaaaaaaaa</Key>
<Password>aaaaaaaaaaaaaaaa</Password>
</UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
<AccountNumber>111111111</AccountNumber>
<MeterNumber>111111111111</MeterNumber>
</ClientDetail>
<Version>
<ServiceId>ship</ServiceId>
<Major>12</Major>
<Intermediate>0</Intermediate>
<Minor>0</Minor>
</Version>
<RequestedShipment>
<ShipTimestamp>2016-09-06T06:42:41-04:00</ShipTimestamp>
<DropoffType>REGULAR_PICKUP</DropoffType>
<ServiceType>SMART_POST</ServiceType>
<PackagingType>YOUR_PACKAGING</PackagingType>
<TotalWeight>
<Units>LB</Units>
<Value>15.00</Value>
</TotalWeight>
<Shipper>
<AccountNumber>111111111111</AccountNumber>
<Tins>
<TinType>BUSINESS_STATE</TinType>
<Number444444444444</Number>
</Tins>
<Contact>
<CompanyName>aaaaaaaaaaaa</CompanyName>
<PhoneNumber>11111111</PhoneNumber>
</Contact>
<Address>
ADDRESS HERE
</Address>
</Shipper>
<Recipient>
<Contact>
<PersonName>mukta jain</PersonName>
<PhoneNumber>1234567899</PhoneNumber>
</Contact>
<Address>
<StreetLines>lwehcfkwdjh</StreetLines>
<City>NY</City>
<StateOrProvinceCode>NY</StateOrProvinceCode>
<PostalCode>12345</PostalCode>
<CountryCode>US</CountryCode>
<Residential>true</Residential>
</Address>
</Recipient>
<ShippingChargesPayment>
<PaymentType>SENDER</PaymentType>
<Payor>
<ResponsibleParty>
<AccountNumber>444444444</AccountNumber>
<Tins>
<TinType>BUSINESS_STATE</TinType>
<Number>4444444444</Number>
</Tins>
<Contact>
<CompanyName>aaaaaaaaa</CompanyName>
<PhoneNumber>111111111</PhoneNumber>
</Contact>
<Address>
<ADDRESS HERE>
</Address>
</ResponsibleParty>
</Payor>
</ShippingChargesPayment>
<SmartPostDetail>
<Indicia>PARCEL_SELECT</Indicia>
<AncillaryEndorsement>ADDRESS_CORRECTION</AncillaryEndorsement>
<SpecialServices>USPS_DELIVERY_CONFIRMATION</SpecialServices>
<HubId>1234</HubId>
<CustomerManifestId>123456</CustomerManifestId>
</SmartPostDetail>
<LabelSpecification>
<LabelFormatType>COMMON2D</LabelFormatType>
<ImageType>EPL2</ImageType>
<LabelStockType>STOCK_4X6</LabelStockType>
</LabelSpecification>
<RateRequestTypes>LIST</RateRequestTypes>
<PackageCount>3</PackageCount>
<RequestedPackageLineItems>
<SequenceNumber>1</SequenceNumber>
<GroupPackageCount>1</GroupPackageCount>
<Weight>
<Units>LB</Units>
<Value>5</Value>
</Weight>
<Dimensions>
<Length>7</Length>
<Width>7</Width>
<Height>7</Height>
<Units>IN</Units>
</Dimensions>
<CustomerReferences>
<CustomerReferenceType>INVOICE_NUMBER</CustomerReferenceType>
<Value>E2315141</Value>
</CustomerReferences>
<CustomerReferences>
<CustomerReferenceType>CUSTOMER_REFERENCE</CustomerReferenceType>
<Value>E2315141</Value>
</CustomerReferences>
</RequestedPackageLineItems>
</RequestedShipment>
</ProcessShipmentRequest>
You give us almost nothing to work with, so it's hard to be any help at all. But there's one thing that seems strange in your request body. Assuming that you're showing us a dump of a Perl data structure, it seems weird that all of your scalar values are implemented as anonymous arrays. For example, the line defining the package count is:
'PackageCount' => [ 3],
Where I'd expect to see:
'PackageCount' => 3,
It's possible that you have access to some documentation that tells you to do it this way, but it seems strange to me.
It would also explain the error message as the array reference would be interpreted as an integer which would almost certainly be far greater than any number expected by the API!
Update: When I wrote this answer, the question included what looked like a large Perl data structure which exhibited the weirdness that I discuss above. Now that has been changed to an XML document which seems to have the correct values. I have no idea where the original data structure came from or how it was used. And, in the absence of any feedback from the original poster, I have no idea how useful this answer is.

Quickbooks Desktop BillPaymentCheckAdd error object not found

I am trying to add a $20 payment to a bill. This is from the sample Quickbooks file. However i am getting the error Object \"3E42-1071498278\" specified in the request cannot be found. " Any ideas. I have tried multiple things. I have indeed checked that the bill exists. I have included below the generated qbxml from the sdk. I am using version 13 of the sdk and QB version 14. Changing the date has no bearing on the error response
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError = "continueOnError">
<BillPaymentCheckAddRq requestID = "0">
<BillPaymentCheckAdd>
<PayeeEntityRef>
<FullName>Sergeant Insurance</FullName>
</PayeeEntityRef>
<APAccountRef>
<FullName>Accounts Payable</FullName>
</APAccountRef>
<TxnDate>2017-01-21</TxnDate>
<BankAccountRef>
<ListID>20000-933270541</ListID>
<FullName>Checking</FullName>
</BankAccountRef>
<RefNumber>11000</RefNumber>
<Memo>786-35 Sample</Memo>
<ExchangeRate>1.000000</ExchangeRate>
<AppliedToTxnAdd>
<TxnID>3E42-1071498278</TxnID>
<PaymentAmount>20.00</PaymentAmount>
</AppliedToTxnAdd>
</BillPaymentCheckAdd>
</BillPaymentCheckAddRq>
</QBXMLMsgsRq>
</QBXML>
The error says the transaction with that ID cannot be found. You may see the transaction in QB, but how do you know that the transaction you are looking at in QB has that ID? QB does not think it does.
I would expect to see a BillToPayQueryRq and pulling the transactionID out of the BillToPayQueryRs.
Make sure the payeeEntityRef matches the Bill Txn. You can provide a valid TxnID but if it is not tied to the proper Payee QB will give a TXNID not found error.

Retrieve a List of All Checks for an Account using qbXML

I'm working on a website for a client that integrates into QuickBook desktop. I need to get a listing of all the checks for a specific account (ideally I would like all transactions for that account [regardless of their type] but if I have to get them one at a time that's fine). When I send the following XML:
<ns1:sendRequestXMLResponse>
<ns1:sendRequestXMLResult>
<xml version="1.0" encoding="utf-8" ?>
<qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<CheckQueryRq>
<AccountFilter>
<ListID>800000F1-1362066981</ListID>
</AccountFilter>
<IncludeLineItems>true</IncludeLineItems>
</CheckQueryRq>
</QBXMLMsgsRq>
</QBXML>
</ns1:sendRequestXMLResult>
</ns1:sendRequestXMLResponse>
I receive the following error:
<CheckQueryRs statusCode="1" statusSeverity="Info" statusMessage="A query request did not find a matching object in QuickBooks" />
If I go into QuickBooks I can see there are checks associated with the account so I'm not sure why this doesn't return a result.
Update 1: I rewrote this without the AccountFilter so it returned every check and I found checkes with the 800000F1-1362066981 account. It's also 10 MB so it's really hard to work with. :-)