What would you use for a successful HTTP status code but wanted to indicate some warnings? In my case, I'm making an ajax endpoint where you can add a new user. We expect a first and last name, but if there isn't one, the record will still be created and no followup to correct the situation will be expected. I just want the client to know "We created the record, and hey, BTW, the first and/or last name was blank"
I found this question, but that's about actual ensuing errors, not warnings.
It seems to be an optimal way to put something like {"status":"warn","meassage":"Name field is empty"}
to the response body.
There is no "warning" HTTP codes. You can of course use for example 201 CREATED
for clean creation and 200 OK
for warnings. But that's not a good way to use them.
Don't use for this HTTP status.
Use for this body of response. For example in JSON
{warnings:true, warning:'We created the record, and hey, BTW, the first and/or last name was blank'}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With