Mapping saved architecture for CRUD functions

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.

+3
1

REST - . , , CRUD, , . REST . (. )

REST-afarians RESTful, : . , (), /. . Hypermedia. , . ( , ):

- GET /database -> List of databases
- GET /database/{name} -> List of tables
- GET /database/{name}/{table}?page=1 -> First set of rows in table XXXXX
- POST /database/{name}/{table} -> Create a record
- PUT /database/{name}/{table}/{PK} -> Update a record
- DELETE /database/{name}/{table}/{PK} -> Send the record to the big PC in the sky..

!

REST CRUD , Straitjacket: URI . , , / URI, () underling, -.

:

+1

All Articles