MYOBCommunity
Partner Zone
|
|
Partner Zone

Retrieving large result sets gives random 401 errors

This thread is now closed to new comments.
Some of the links provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
2 REPLIES 2
Contributing Partner JohnSSell
14 Posts
Contributing Partner
Australia
JohnSSell
Contributing Partner

14Posts

0Kudos

2Solutions

Accepted Solution Solved Solution

Re: Retrieving large result sets gives random 401 errors

Found the issue, tokens were expiring during the import process. Just had to keep an eye on expiry and refresh them.

 

Good explanation on how to do it here:

http://community.myob.com/t5/AccountRight-and-Essentials-API/Cloud-Authentication-Issues-403-Forbidd...

Contributing Partner JohnSSell
14 Posts
Contributing Partner
Australia
JohnSSell
Contributing Partner

14Posts

0Kudos

2Solutions

Re: Retrieving large result sets gives random 401 errors

Getting the exact same error but with large amounts of customers. Random 401 part way through retrieving the result set.

 

Also sent a couple of emails to developers@myob.com.au and got no response...

 

Going to try to grab a larger amount of results per page and wait several seconds between each call, see if that will help...

Highlighted
Contributing Partner JohnSSell
14 Posts
Contributing Partner
Australia
JohnSSell
Contributing Partner

14Posts

0Kudos

2Solutions

Solved: Go to Solution

Retrieving large result sets gives random 401 errors

We are trying to get a large set of invoices and randomly after thousands of invoices MYOB will spit back a 401 error.

 

I originally thought we were hitting the limit of requests per second, so I implemented a process where if we received a 401 it would wait 10 seconds then retry the query. This didn't solve the issue.

 

Anybody have any ideas on how to solve this?

 

Requests where the result set returned a 401:

Sale/Invoice/Item/?$top=400&$skip=8000&$filter=Date ge datetime'2015-12-01'

Sale/Invoice/Item/?$top=400&$skip=20800&$filter=Date ge datetime'2015-12-01'

Sale/Invoice/Item/?$top=400&$skip=11200&$filter=Date ge datetime'2015-12-01'

 

Error:

04-08-2016 09:07:33 AM : An Exception has occurred. 
	Type : MYOB.AccountRight.SDK.ApiCommunicationException
	Message : Encountered a communication error (/Sale/Invoice/Item/?$top=400&$skip=20800&$filter=Date ge datetime'2015-12-01')
	Stacktrace : 
   at Microsoft.VisualBasic.CompilerServices.Symbols.Container.InvokeMethod(Method TargetProcedure, Object[] Arguments, Boolean[] CopyBack, BindingFlags Flags)
   at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
   at com.strategicecommerce.straightsell.cataloguelink.integrations.myoblive.dbwrappers.clDataSource.getInvoices(String filter, Boolean delay)

	Inner Exception: 
				Type : System.Net.WebException
				Message : The remote server returned an error: (401) Unauthorized.
				Stacktrace :    at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at MYOB.AccountRight.SDK.Communication.BaseRequestHandler.HandleResponseCallback[T,TReq,TResp](IAsyncResult asynchronousResult)
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