在可用的情况下提供完整的资源

尽可能在响应中提供完整的资源表示(即具有所有属性的对象)。始终提供 200 和 201 响应的完整资源,包括PUT/PATCHDELETE 请求,例如:

$ curl -X DELETE \
  https://service.com/apps/1f9b/domains/0fd4

HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
...
{
  "created_at": "2012-01-01T12:00:00Z",
  "hostname": "subdomain.example.com",
  "id": "01234567-89ab-cdef-0123-456789abcdef",
  "updated_at": "2012-01-01T12:00:00Z"
}

202 响应将不包括完整的资源表示,例如:

$ curl -X DELETE \
  https://service.com/apps/1f9b/dynos/05bd

HTTP/1.1 202 Accepted
Content-Type: application/json;charset=utf-8
...
{}

results matching ""

    No results matching ""