How to return a warning message from a successful POST request


I am currently working on an API which implements an extended Basic resource. One of the optional extensions we have defined for this resource will trigger additional processing if it is included in a POST request. Our current customer has requested that if the validation for this extension fails, then the resource should still be processed as being valid, but the POST response should include a warning message saying that the non-essential data is invalid.

What would be the nicest way of including this warning message in the POST response? My only thought would be to add an OperationOutcome resource with severity = warning as a contained resource, and then add a new extension with a reference to the OperationOutcome resource, but this approach feels a bit messy for my liking. Any other suggestions/input would be greatly appreciated.



Servers are allowed to return OperationOutcome as the response to a PUT, POST or DELETE if the client asks for it.


Lloyd, Thanks a lot for the reply, we are using DSTU2 but I believe it’s still okay to honor the Prefer: return=OperationOutcome header.

Then the next question is if the consuming party sends a put/post/patch request with Prefer: return=OperationOutcome, header then how to send the created resource ID back; Is it a good idea to extend the OperationOutcome to include a reference to the created resource, or is there a better way to handle this.

Thanks in advance


The id will be part of the location header. And the version will be in the Etag header.