Use the @PostAction
annotation to invoke a method after an endpoint method. The value
parameter of the annotation is the endpoint method’s name. This method should use the same parameters as the endpoint method, as well as use an extra parameter that matches the return type of the endpoint method. This ensures that the endpoint response can be passed into the post action method. The post action should return the response object again, following any modifications to the response:
For example:
@POST @Endpoint(id="/{commerceItems}/#POST", validatorId="commerceitems.add", filterId="commerceitems-CollectionDefault", updateTarget=true) public RepresentationModel addItems(JSONObject pInputData) throws RestException { // endpoint logic } @PostAction("addItems") public RepresentationModel afterAddItems(JSONObject pInputData, RepresentationModel pRepresentationModel) throws RestException { // post endpoint logic return pRepresentationModel; }