Re: Communicating Warning Information in HTTP APIs

André Cedik <andre.cedik@googlemail.com> Tue, 19 November 2019 18:51 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5F0AF1201E5 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 19 Nov 2019 10:51:40 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.751
X-Spam-Level:
X-Spam-Status: No, score=-2.751 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HTML_MESSAGE=0.001, MAILING_LIST_MULTI=-1, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=googlemail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QHsDuA_0bobL for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 19 Nov 2019 10:51:38 -0800 (PST)
Received: from frink.w3.org (frink.w3.org [IPv6:2603:400a:ffff:804:801e:34:0:38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 76D33120105 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 19 Nov 2019 10:51:38 -0800 (PST)
Received: from lists by frink.w3.org with local (Exim 4.89) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1iX8Yh-0006R2-Na for ietf-http-wg-dist@listhub.w3.org; Tue, 19 Nov 2019 18:49:03 +0000
Resent-Date: Tue, 19 Nov 2019 18:49:03 +0000
Resent-Message-Id: <E1iX8Yh-0006R2-Na@frink.w3.org>
Received: from mimas.w3.org ([2603:400a:ffff:804:801e:34:0:4f]) by frink.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from <andre.cedik@googlemail.com>) id 1iX8Yf-0006QA-Fi for ietf-http-wg@listhub.w3.org; Tue, 19 Nov 2019 18:49:01 +0000
Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by mimas.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <andre.cedik@googlemail.com>) id 1iX8Yd-0007rL-Rs for ietf-http-wg@w3.org; Tue, 19 Nov 2019 18:49:01 +0000
Received: by mail-wr1-x431.google.com with SMTP id s5so25183390wrw.2 for <ietf-http-wg@w3.org>; Tue, 19 Nov 2019 10:48:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=4BKaGpPa8u03KKhS5zIW1nO78O3KmfSNRXFmfrfd5Fo=; b=jgpgJ1ZxElG7VKkhgo//FPmAyxiR2YZ+q06ln0avHKlty6nQDAiSxyiw5u0lmshnz/ DjS42RwZ2MFNCwVep/ZPnGLFzPQ8zUBLEd/lvyaLhq/MPj3NaEyzVYoL3NhFI7fP064F tLAYy9SvSGQ7Mhp7qD2hzS+AeOW0GIJjvfw/Qj5FxAWSihhG204it9VFeRHX07UL6FVg 2SS1u2KqcrIl1OA+OlY1j0UZt0jMxRq3Re48Ni34UK+CLGAvjVV/rqfhIyGeeBJlHlsA 0B08h3L9cxl12nPZx7RFxbTCOobDlCnwt4WX73RAtKasz4sR5RT+TC8UPFIYjKFkQBm4 HRrw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=4BKaGpPa8u03KKhS5zIW1nO78O3KmfSNRXFmfrfd5Fo=; b=XdtEVSMpXjowuRkrydaG3uP0CoL9ORWkLPOPXBbc4B+wrAYs2qI7Inj0wU2VNQknf1 Va7dxJ6l+jFuGb4at/AA9H24/PVxnpBPva7FSph1TDVerQGUUVPC5htkiaZ1i9LyRVPo tfEv3K2pw5uVcEUt4ba4Ta747WQMbnkhSB8+0vTe5HwIYSOVXLT522kslgKYeDInbjzb pxDjF89mXaSThK891xyFpA46m+xUHTehqqcpisk1Kz8cRTtfidzcfB7rA389K3trShgI IsBO+gmwZhZE0HffZE0V341V67ZTvQwPHlaZTnpRWOqZZfF28bSCOtSs/NcWJu9ImWMo yBbg==
X-Gm-Message-State: APjAAAVCV4nD7iSLCAMHMSscpFELgrj5Kip12EzqFdWRxEHNKc2Goit+ r4t7SROGGI5fKMsC8xmr2BMkCh5BlbYqeM0PIIGxToPf6yQ=
X-Google-Smtp-Source: APXvYqwHhMsPOa6G6bs5nHku9ZRh4HbIL4n+YT0NEzvHylHq37N2nCnp9FlyAfrz/4l4oDuec2RjzvH0a4TnBM+v/N4=
X-Received: by 2002:a5d:640d:: with SMTP id z13mr12957283wru.68.1574189337430; Tue, 19 Nov 2019 10:48:57 -0800 (PST)
MIME-Version: 1.0
From: André Cedik <andre.cedik@googlemail.com>
Date: Tue, 19 Nov 2019 19:48:46 +0100
Message-ID: <CAEQcYZh2zN_LvWpVrL=aPMadmL-2ZuVMaX4dc+L2shLsEJg_Qg@mail.gmail.com>
To: ietf-http-wg@w3.org
Content-Type: multipart/alternative; boundary="0000000000004455040597b78462"
Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=andre.cedik@googlemail.com; helo=mail-wr1-x431.google.com
X-W3C-Hub-Spam-Status: No, score=-4.1
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: mimas.w3.org 1iX8Yd-0007rL-Rs 377f21eedf00025e28bdc1314afe7cf8
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Communicating Warning Information in HTTP APIs
Archived-At: <https://www.w3.org/mid/CAEQcYZh2zN_LvWpVrL=aPMadmL-2ZuVMaX4dc+L2shLsEJg_Qg@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/37152
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <https://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

It is our goal to provide an easy way for API consumers to react to the
fact, that something has happened which they could/should act upon.

Since HTTP response status codes do not provide a category / a single code
for telling the client that there are warnings, our best bet was / is to
use the warning header to actually warn the api consumer and make it easy
for them act.

For the API consumer it should be just as easy to check whether the
response has an HTTP status code of 200 (when successful) or > 400 (when an
error occurred) as it should be to find out that something has happened (in
the backend), that caused a warning.

When providing only the JSON structure in the body, an API consumer would
always have to parse the body to get the "warnings"-entry and see if it is
filled with content.

When also providing a header, the consumer wouldn't necessarily have to
parse the body which would remove the need to parse large response bodies
(depending on the use case).

I can also imagine that API providers would like to provide the option to
send a request via the HTTP HEAD method to make it possible for consumers
to see if their request would be rejected, returns warnings or is
successful, when doing the actual POST request.