MYOBCommunity
Partner Zone
|
|
Partner Zone

Accountright API errors codes on PUT request

1 REPLY
Contributing Partner pat80
5 Posts
Contributing Partner
pat80
Contributing Partner

5Posts

1Kudos

0Solutions

Re: Accountright API errors codes on PUT request

I found the issue.

 

Working with PHP, the recent version update caused the json_encode function to address floats with a precision of 14. When looking closely we see its a total mess of numbers. So the assumption is MYOB recognises the total sums aren't correct and so gets rejected.

 

For further information 

https://stackoverflow.com/questions/42981409/php7-1-json-encode-float-issue/43056278#43056278

 

I used heroku to deploy the app. using the suggested code enabled me to set the precision to -1. This then keeps the floats to 2 decimal places.

if (version_compare(phpversion(), '7.1', '>=')) {    ini_set( 'serialize_precision', -1 );
}

 

Contributing Partner pat80
5 Posts
Contributing Partner
pat80
Contributing Partner

5Posts

1Kudos

0Solutions

Accountright API errors codes on PUT request

Hi,

 

I've been having a problem recently with PUT requests not successfully updating an invoice from the "to be printed" state to "Printed adn sent state".

In the past, the strategy was to apply a PUT request with the entire invoice data back in with the modified field and that worked.

But lately, I have been missing updates with high rate. Some days as low as 50% hit rate, some days higher. 

 

( 
      [Errors] => Array 
          ( 
              [0] => Array 
                  ( 
                      [Name] => ValidationError 
                      [Message] => CommonRules_DecimalPrecision 
                      [AdditionalDetails] => AmountSmiley SadSaleEventItemLine) 
                      [ErrorCode] => 1024 
                      [Severity] => Error 
                  ) 
              [1] => Array 
                  ( 
                      [Name] => ValidationError 
                      [Message] => SaleEventLine_ItemTotalAmountUnBalanced 
                      [AdditionalDetails] => AmountSmiley SadSaleEventItemLine) 
                      [ErrorCode] => 4341 
                      [Severity] => Error 
                  ) 
              [2] => Array 
                  ( 
                      [Name] => ValidationError 
                      [Message] => CommonRules_DecimalPrecision 
                      [AdditionalDetails] => TotalAmountSmiley SadSaleEventItemLine) 
                      [ErrorCode] => 1024 
                      [Severity] => Error 
                  ) 
          ) 
      [Information] => Warning, error messages have not been finalised in this release and may change 

I've been reviewing invoices trying to identify the 1024 error issue but inside Accountright program, all values appear valid with single decimal. Of  concern is what is errorcode 4341.

 

Furthermore, The header return has 400 code. If this is any relevance.

x-myobapi-version: v2  
Content-Length: 3960  
Expect: 100-continue  
< HTTP/1.1 100 Continue  
* We are completely uploaded and fine 
< HTTP/1.1 400 Bad Request  
< Cache-Control: no-cache  
< Content-Type: application/json; charset=utf-8  
< Date: Wed, 07 Mar 2018 05:19:45 GMT  

Appreciate any help.

Didn't find your answer here?
Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post