Reputation: 6372
What is the correct http error code for geographical restriction?
Meaning, the service has a resource that is limited for access only from several countries. The service needs to fail all requests not from the closed list of approved countries.
Should I use 403?
Upvotes: 2
Views: 940
Reputation: 7744
Yes, I would also use 403
. You may additionally change the status string to say it is "Geo restricted", or something.
If you want it to be automatically consumable, you may also define a special error format (media-type
) that would contain some details about the issue.
Upvotes: 2