I have a JSON web service to return home markers to be displayed on my Google Map.
Essentially, http://example.com
calls the web service to find out the location of all map markers to display like so:
http://example.com/json/?zipcode=12345
And it returns a JSON string such as:
{"address": "321 Main St, Mountain View, CA, USA", ...}
So on my index.html
page, I take that JSON string and place the map markers.
However, what I don't want to have happen is people calling out to my JSON web service directly.
I only want http://example.com/index.html
to be able to call my http://example.com/json/
web service ... and not some random dude calling the /json/
directly.
Quesiton: how do I prevent direct calling/access to my http://example.com/json/
web service?
UPDATE:
To give more clarity, http://example.com/index.html
call http://example.com/json/?zipcode=12345
... and the JSON service
- returns semi-sensitive data,
- returns a JSON array,
- responds to GET requests,
- the browser making the request has JavaScript enabled
Again, what I don't want to have happen is people simply look at my index.html
source code and then call the JSON service directly.