New in the game! Framework and web development in general, I'm trying to make a simple REST GET for a web service and just get JSON directly in response. By typing the URL in the browser, I get the perfect answer with well-formatted JSON. Calling it by code, it just explodes:
WS.WSRequest wsRequest = WS.url( serviceURL ); wsRequest.timeout( timeoutTime ); wsRequest.setHeader("Accept", "application/json"); wsRequest.headers.put( "Content-type","application/json" ); wsRequest.mimeType = "application/json"; WS.HttpResponse response = wsRequest.get(); String graphServiceResponse = response.getJson().toString();
Everything runs fine until the last line throws an exception and errors. I know that I have something like redundant code; these are my attempts to fix it. As I said, typing "serviceURL" in the browser works fine.
Does anyone know what I'm doing wrong? Thanks in advance!
source share