CRUD API
REST API - CRUDS reference
Resource vs HTTP Methods Base url - http://localhost:8080/palmyra/{database}/
Assuming the table name is - Users
| Resource | GET | POST | PUT | DELETE |
|---|---|---|---|---|
| /data/Users | Return list of users with all fields | Create a new user | Create or Update user | Method not allowed (405) |
| /data/Users/123 | Return specific user with all fields | Method not allowed (405) | Update specific user | Delete specific user |
| /query/Users | Method not allowed (405) | Return list of users with specified fields | Method not allowed (405) | Method not allowed (405) |
| /query/Users/123 | Method not allowed (405) | Return specific user with specified fields | Method not allowed (405) | Method not allowed (405) |
Samples
HTTP Response codes
2xx Success
200 OK: Returned by a successful GET, PUT, POST or DELETE operation.
201 Created: Response for a successful resource creation by a POST request.
204 No content: Response for No data while searching for single item by Unique Key
4xx Client Errors
400 Bad Request: When an HTTP request body can’t be parsed. For example, if an API is expecting a body in a JSON format for a POST request, but the body of the request is malformed.
401 Unauthorized: Authentication is unsuccessful (or credentials have not been provided) while accessing the API.
403 Forbidden: If a user is not Authorized to perform an action although authentication information is correct.
404 Not Found: If the requested resource is not available on the server.(GET, PUT, DELETE)
405 Method Not Allowed: If the user is trying to violate an API contract, for example, trying to update a resource by using a POST method.
5xx Server Errors
These errors occur due to server failures or issues with the underlying infrastructure.