Use RESTful service URLs
Under REST principles, a URL identifies a resource. The following URL design patterns are considered REST best practices:
- URLs should include nouns, not verbs.
- Use plural nouns only for consistency (no singular nouns).
- Use HTTP methods (HTTP/1.1) to operate on these resources:
- Use HTTP response status codes to represent the outcome of operations on resources.
Response Http Status Code
- 200 OK
- 400 Bad Request
- 500 Internal Server Error
Other commonly seen codes include:
- 201 Created
- 204 No Content
- 401 Unauthorized
- 403 Forbidden
- 404 Not Found
jQuery Ajax Request
- type: ‘GET’ —- dataType: ‘xml|json|script|text|html’ -> response http status code: 200 / 404
- type: ‘POST’ —– dataType: ‘xml|json’ -> response http status code: 201 (created) / 405 (Method Not Allowed)
- type: ‘PUT’ —— dataType: ‘xml|json’ -> response http status code: 200 / 404