Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

21
  • 52
    "If someone tries to call our service API from any other city" note that IP geolocation is very often wrong, if you forbid any user whose IP geolocates to a different city you will very likely be locking out legitimate users. Commented Jul 12, 2018 at 16:54
  • 43
    Am I not allowed to hail a ride for my child, who is in another city and needs to come to the airport in order to visit me? Commented Jul 12, 2018 at 20:01
  • 30
    While not an answer to the question, HTTP 451 (RFC 7725) may be useful to future readers who find this question. It's main purpose is to indicate content is not available due to a legal request, action, or restriction (copyright, court order, etc.) Commented Jul 12, 2018 at 20:20
  • 35
    If there is nothing wrong with the network connectivity, authentication, no errors internally in the application, and syntactically valid input there shouldn't be an error message. With "we don't offer our service in this area" you've left technology issues and gone into business issues, so I'm not sure a HTTP error would be appropriate. I think you should give a 200 and (or 302 and redirect to) an appropriate message about "sorry our service isn't available in your area - yet. But we're expanding - Check back in late 2019!" or whatever the marketing dept comes up with. Commented Jul 12, 2018 at 21:59
  • 7
    It's unclear from the question whether you mean to block all access to the API based on the client computer's location (geo IP?) or if you're asking for the response code for a particular failed API request (e.g. book?address=123_example_st_london). Is the location part of the input, or do you have the client's location some other way? Commented Jul 13, 2018 at 5:13