What are the best practices to create a standard URI for a web service?

Technology CommunityCategory: API DesignWhat are the best practices to create a standard URI for a web service?
VietMX Staff asked 3 years ago

Following are important points to be considered while designing a URI:

  • Use Plural Noun − Use plural noun to define resources. For example, we’ve used users to identify users as a resource.
  • Avoid using spaces − Use underscore(_) or hyphen(-) when using a long resource name, for example, use authorized_users instead of authorized%20users.
  • Use lowercase letters − Although URI is case-insensitive, it is good practice to keep url in lower case letters only.
  • Maintain Backward Compatibility − As Web Service is a public service, a URI once made public should always be available. In case, URI gets updated, redirect the older URI to new URI using HTTP Status code, 300.
  • Use HTTP Verb − Always use HTTP Verb like GET, PUT, and DELETE to do the operations on the resource. It is not good to use operations names in URI.