There are at least two problems here that prevent you from being RESTful.
Each resource must be identified using a URI. An action on a resource means that you must call the URI with an HTTP call. Therefore, you cannot invoke multiple actions on multiple resources with just one HTTP call.
Resources are identified by nouns and represent entities. This means that to insert Employee and Car you need to call two different resources for each of the corresponding objects.
Thus, in summation, you cannot use a purely RESTful approach here. However, REST is intended to be an aid in the form of conventions, not limitation. The best solution here is to create a custom action that does what you need.
Alternatively, you can create a common wrapper object with INSERT, UPDATE, and other actions that take in disparate data blocks as XML. However, this undermines your other endpoints because it is now possible to insert a Car record through a common shell and through a URI /Car/ .
Unaware of your actual requirements, I would advise you not to disclose this function with REST. Behind the scenes, you can still invoke your INSERT action methods in different controllers, as soon as you break the incoming collection if there are disparate objects.
source share