- 
                Notifications
    
You must be signed in to change notification settings  - Fork 112
 
REST API design
        Patrick José Pereira edited this page Feb 4, 2022 
        ·
        6 revisions
      
    An endpoint and payload variables should follow the snake_case convention. The languages and code style used in the project already follows this convention.
A delete endpoint should only accept the method DELETE and follow the format:
/delete_something/{something_id}
Where something_id is an unique identifier.
- Use the proper return code, E.g: Ok, NotFound, NotAcceptable and etc.
 - Ensure that the content type is correct: 
application/json,text/plain,text/xmland etc. - Register the endpoint with the correct methods:
- Removing something or deleting should only accept DELETE method.
 - Adding or registering something new should only accept POST
 - An informative endpoint should only accept GET.
 
 - If an endpoint deletes or adds something, it should return as payload the new content.
 
Every service should provide a /backup endpoint, used for saving and loading settings externally.
This endpoint should accept at least a GET and a POST route, for saving and loading, respectively.
The GET endpoint should respond with a JSON formatted string that, when sent to the POST route,
should be loaded without modifications.