I have and endpoint from a REST API that creates an entity, but the endpoint does not return any data.
Would it be ok to return a
201 status code means that a resource has been created. The
204 status code is not suitable for this situation.
A response for a request that creates a resource should have the
201 status code and the
Location HTTP header with a URI that identifies the newly created entity. Quoting the RFC 7231, the current reference for semantics and content of the HTTP/1.1 protocol:
201(Created) status code indicates that the request has been fulfilled and has resulted in one or more new resources being created. The primary resource created by the request is identified by either a
Locationheader field in the response or, if no
Locationfield is received, by the effective request URI. [...]