I am trying to develop my first service in Java and have some problems displaying methods in a CRUD function.
My uri structure looks like this and maps to the underlying database structure:
/ database / {schema} / {table} /
/ databases are static
{schema} and {table} are dynamic and respond to a path parameter
This is what I have:
Method - URI - DATA - Comment
GET - /databases - none - returns a list of databases
POST - /databases - database1 - creates a database named database1
DELETE - /databases - database1 - deletes the database1 database
PUT - /databases - daatbase1 - updates database1
In the above example, I go through the database name as a JSON object. However, I am not sure if this is correct. Should I do this (using the DELETE method as an example):
Method - URI - DATA - Comment
DELETE - /databases/database1 - none - deletes the database with the same name
If this is the correct method, and I needed to pass additional data, then it will be correct:
Method - URI - DATA - Comment
DELETE - /databases/database1 - some data - deletes the database with the same name
Any comments would be appreciated.