HTTP status code for a partial successful request

前端 未结 4 2044
春和景丽
春和景丽 2020-11-29 02:22

I have an application that sends messages to users. In a post request a XML string is transferred that consists of all the users that should receive that particular message.

4条回答
  •  悲&欢浪女
    2020-11-29 03:05

    I've had the same problem, and I've ended up using two different solutions:

    • HTTP return code 202: Accepted, indicating that the request was ok, but there's no guarantee everything actually went as it should.
    • Return a normal 200 in the response, but include a list of what didn't pan out in the response body.

    The second one usually works best, but the first one is great if you're lazy or use a queue for processing.

提交回复
热议问题