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.

7
  • 6
    This should be the accepted answer: API design is not only about complying with old numerical codes, and the scenario about vpn's etc is quite realistic. Commented Jul 13, 2018 at 9:18
  • 10
    I have to disagree with this. Including the name of the city in the URL could lead to all sorts of problems down the road, because it forces the client to determine a city name based on the location, and you well may not like the result. For example, are you in Los Angeles or Beverly Hills? London or Westminster? What happens if the client thinks it's in Richardson, but you want an API to serve the entire Dallas area? It would be a better idea for the client to just supply the pickup/dropoff locations; the server can determine whether they're within the service area and respond accordingly. Commented Jul 13, 2018 at 22:42
  • 11
    @ZachLipton I'm pretty sure the city names were an example only, it depends on the OP's actual business rules how they define "city" or "location". It could as well be a coordinate. Commented Jul 14, 2018 at 8:37
  • 1
    @ZachLipton no, the point here is not having the service use client IP to understand the location, that is just wrong Commented Jul 15, 2018 at 20:00
  • 3
    @eddyce I agree that using the client IP is a bad idea for many reasons. I'm saying that /API/Vienna/HailRide is also prone to problems, because it requires the client to convert locations into city names, and that's not a 1-to-1 mapping that corresponds with the areas a company does business. Commented Jul 15, 2018 at 20:15