Encountered a validation error (https://ar1.api.myob.com/accountright/e508a89c-da8c-4a4a-847d-ee2897be59b6/Sale/Order/Item/?warningsAsErrors=true)

This thread is now closed to new comments.
Some of the links and information provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
1 REPLY 1
Experienced Partner kirsten
94 Posts
Experienced Partner
Australia
Experienced Partner

94Posts

2Kudos

3Solutions

Accepted Solution Solved

Re: Encountered a validation error (https://ar1.api.myob.com/accountright/e508a89c-da8c-4a4a-847d-ee2897be59b6/Sale/Order/Item/?warningsAsErrors=true)

The answer is at http://developer.myob.com/api/accountright/arlive-sdk/dotnet_sdk/tips-tricks-troubleshooting/

I had to cast the exception to MYOB.AccountRight.SDK.ApiValidationException and then look at the Errors collection
Highlighted
Experienced Partner kirsten
94 Posts
Experienced Partner
Australia
Experienced Partner

94Posts

2Kudos

3Solutions

Solved: Go to Solution

Encountered a validation error (https://ar1.api.myob.com/accountright/e508a89c-da8c-4a4a-847d-ee2897be59b6/Sale/Order/Item/?warningsAsErrors=true)

In my C# code I catch the following error when attempting to post a sales order

Where Can I find the actual validation message?

 

MYOB.AccountRight.SDK.ApiValidationException occurred
  HResult=-2146233088
  Message=Encountered a validation error (https://ar1.api.myob.com/accountright/e508a89c-da8c-4a4a-847d-ee2897be59b6/Sale/Order/Item/?warningsAsErrors=true)
  Source=MYOB.AccountRight.SDK
  ErrorInformation=Warning, error messages have not been finalised in this release and may change
  RequestId=6daa5721-a859-402f-b105-16aba5824ead
  StackTrace:
       at MYOB.AccountRight.SDK.Extensions.ExceptionExtensions.ProcessException(Exception ex, Uri requestUri) in c:\projects\accountright-live-api-net-sdk\MYOB.API.SDK\SDK\Extensions\ExceptionExtensions.cs:line 60
       at MYOB.AccountRight.SDK.Communication.BaseRequestHandler.<GetResponseTask>d__0`1.MoveNext() in c:\projects\accountright-live-api-net-sdk\MYOB.API.SDK\SDK\Communication\BaseRequestHandler.cs:line 97
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at MYOB.AccountRight.SDK.Communication.ApiRequestHandler.<PostAsync>d__29`1.MoveNext() in c:\projects\accountright-live-api-net-sdk\MYOB.API.SDK\SDK\Communication\ApiRequestHandler.cs:line 319
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at MYOB.AccountRight.SDK.Services.ServiceBase.<MakeApiPostRequestAsync>d__3f`1.MoveNext() in c:\projects\accountright-live-api-net-sdk\MYOB.API.SDK\SDK\Services\ServiceBase.cs:line 269
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at SBD.JobTalk.MYOB.SyncSalesOrders.<Post>d__4.MoveNext() in E:\EShared\Dev2015\SBD.JobTalk.MyobApi\MYOBAPI\SyncSalesOrders.cs:line 129
  InnerException: System.Net.WebException
       HResult=-2146233079
       Message=The remote server returned an error: (400) Bad Request.
       Source=System
       StackTrace:
            at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
            at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
         --- End of stack trace from previous location where exception was thrown ---
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
            at MYOB.AccountRight.SDK.Extensions.WebRequestExtensions.<GetResponseAsync>d__0.MoveNext() in c:\projects\accountright-live-api-net-sdk\MYOB.API.SDK\SDK\Extensions\WebRequestExtensions.cs:line 36
         --- End of stack trace from previous location where exception was thrown ---
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
            at MYOB.AccountRight.SDK.Communication.BaseRequestHandler.<GetResponseTask>d__0`1.MoveNext() in c:\projects\accountright-live-api-net-sdk\MYOB.API.SDK\SDK\Communication\BaseRequestHandler.cs:line 92

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