ReSTful design: return an empty object as a template to create a new form

My question is fear. I think so.

Currently, the following Uris exists:

http://someserver/service/item           GET   returns all items  
http://someserver/service/item           POST  creates a new item  
http://someserver/service/item/{id}      GET   returns item with id {id}  
http://someserver/service/item/{id}      PUT   updates item with {id}  

What I would like to do is return an empty element, for example, a template for creating new elements that contains a list of object parameters, their types, necessary or not. The reason for this is that I would like to create a generic jquery “create a new” plugin, completely unaware of the data structure, which I could apply to all my new objects.

What is the best way to implement this?

Hope this makes sense and thanks for your time.

+3
source share
2 answers

. " ", POST. . , GET , , .

+2

, .

, () , . , , . , "" POST.

GET http://someserver/service/item/template

, GET.

+8

Source: https://habr.com/ru/post/1790676/


All Articles