Is there a flag in the Places API request to get plain JSON response (without any presentation UI & styling) to be viewed on a web browser ?
Thanks,
Venkat
Is there a flag in the Places API request to get plain JSON response (without any presentation UI & styling) to be viewed on a web browser ?
Thanks,
Venkat
Hi, the response is a JSON string, to load the response in the DOM you must to execute the request via XMLHTTPRequest( AJAX ) and load the response via JavaScript.
Places API honors the HTTP header Accept. As browsers usually send something like "text/html", you receive a beautified, interactive HTML representation of the JSON response when you type a Places API request URI in a browser. The only exception of this rule is the JSONP support: Whenever make use of the JSONP callback parameter, Places API will ignore any Accept header and return the JSONP call code.
If you want the bare-bone JSON representation in the browser you have two alternatives:
(1) You use some plugin for your browser (e.g. Modify Headers for Firefox) that allows you to modify/set HTTP headers and set the Accept header to "application/json". This is the suggested solution, as it also allows you to directly use subsequently the hypermedia links contained in the response and you can use the feature also to play around with other HTTP header based features like language preferences)
(2) You use a feature of the Places API for client platforms that don't allow developers to set headers: Places API will internally overwrite the values of HTTP headers if it finds a query string parameter with the same name. You can make use of this and simply pass a different Accept-header value as additional query-string parameter. E.g. http://demo.places.nlp.nokia.com/pla...plication/json.
Andreas Schmidt
Nokia Places API