How to prevent direct access to my JSON service?

Posted by FrankLy on Stack Overflow See other posts from Stack Overflow or by FrankLy
Published on 2010-04-05T03:04:31Z Indexed on 2010/04/05 3:13 UTC
Read the original article Hit count: 310

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about JSON

Related posts about JavaScript