REST API Design Query 2

Khuzi :

Should POST operation support creation of only one resource at a time OR it can accept collection of resources for creation in a single POST request ?

Eric Stein :

POST is intended as a catch-all verb which permits the server to perform any action. While it is most often used to create a single resource, it is certainly within the spec for it to create any number of resources. This is clarified in the updated RFC 7231:

If one or more resources has been created on the origin server as a result of successfully processing a POST request, the origin server SHOULD send a 201 (Created) response containing a Location header field that provides an identifier for the primary resource created (Section 7.1.2) and a representation that describes the status of the request while referring to the new resource(s).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=147465&siteId=1