I have a RESTlet that I have written that I am trying to call using Token Based Authentication (TBA) and via client code where I am already authorized. Using TBA, I get my data back and I am able to JSON.parse my body and everything works fine. Using client code however, even after setting the content-type to application/json, I get an error stating that I should be returning TEXT (which is the default Content-Type) which is not what I am expecting. If I JSON.stringify my results when returning in the restlet, my client code works fine but in my TBA code I have to do 2 JSON.parses in order to get it to an object. Seeing as how i've set my content-type, I should not need to stringify anything and my client code should respect the type.
The ONLY difference between my 2 calls is that my client code is already authorized and I am just using nlapiResolveURL('RESTLET', a, b) to get the internal URL whereas my TBA code is using the external URL and passing along all of the TBA stuff.
Also, has anyone noticed that using nlapiResolveURL('RESTLET', a, b, true); where true returns the external URL does not work either? From NetSuite help: [h=3]Important[/h] If the type argument is set to SUITELET or RESTLET, set displayMode to true to return an external URL. Set displayMode to false, or simply omit the argument, to return an internal URL. For Suitelets and RESTlets, displayMode automatically defaults to false.
So seeing as how this method throws an SSS_INVALID_TYPE_ARG error when setting to true, there is no way to retrieve the external URL of the RESTlet which forces a user to have to use the rest domains webservice to get the domains and then attach that to the internal URL.
Has anyone run into either of these issues? any idea on how to solve?
Thanks!