Thank you for visiting our Partner Zone. This area is an exclusive space for MYOB Partners. Find out how to Partner with MYOB.
August 2019
August 2019
I've taken the following piece of code from the MYOBApiCSharp CompanyFilesForm.cs sample and tried to apply it to my MVC C# code.
_configurationLocal = new ApiConfiguration(LocalApiUrl);
var cfsLocal = new CompanyFileService(_configurationLocal);
cfsLocal.GetRange(OnComplete, OnError);
Fortunately I'm able to send my key and secret to myob and get the required token, send them again so that I retrieve the authoriation code.
I no longer get the 'Bad Request' message, so I feel I'm on the right track, but now, when I get to the GetRange() function, I get the following error:
'Unexpected character encountered while parsing value: <. Path '', line 0, position 0.'
Because the first charater read is a < (less than) it's as if the CompanyFileService class is returning in "application/text" format, with XML, and GetRange is expecting "application/json".
I've tried converting to a WebApi application however I still have the same result. also uder result
Is there a way to make MVC C# tell CompanyFileService() to stick to Json? Or am I way off track?
A working MVC C# sample would be appreciated.
Thank you in advance
Solved! Go to Solution.
August 2019
August 2019
Ok, I fixed it. I rebuilt my application using WebApi.