Re: [httpapi] Interface to inform client about supported content types
Kai Lehmann <kai.lehmann@1und1.de> Tue, 23 May 2023 10:46 UTC
Return-Path: <kai.lehmann@1und1.de>
X-Original-To: httpapi@ietfa.amsl.com
Delivered-To: httpapi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7142DC151551 for <httpapi@ietfa.amsl.com>; Tue, 23 May 2023 03:46:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=1und1.de
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bjY9hZFDITRi for <httpapi@ietfa.amsl.com>; Tue, 23 May 2023 03:46:05 -0700 (PDT)
Received: from moint.1and1.com (moint.1and1.com [212.227.15.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CCBA6C151546 for <httpapi@ietf.org>; Tue, 23 May 2023 03:46:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=1und1.de; s=corp1; h=MIME-Version:Message-ID:Date:Subject:To:From:cc:sender:reply-to; bh=SifxHtTLWBU0f6cDKTUWH5QUmhUiO1LPthJj2TgBpZY=; b=T5VFFapSRyueTpN0Cu6WFkSng Qf+a83bDwmrQMAwWEwsuu3jUwbjoO+JCWHsmJbIQlzcoWrdgzd6GFTZZAy7fUXWXIxUv18ChRkYbh cimiAk4s5W8PbhYYWXLCu3KmCFBkmalz0IhklWoXo0XBFZcMKGB7iXq55bwGZFXBBiRr0hQ/b7e4y 41gx0e79Fzyt//rGVxH4m7VHm4beUvNjSBpHECCcfVHto2RcpEqtiWMNPXtAZgjWjfQVVvIdsilH0 yfYQsHnKWh66hKLA2YCW+xIYD6CGv2+LymDAY2nnNT8KuuHzrjVYA8e8W8KmrTWQJe33UvEcwTs+Q 34MhHpxWg==;
Received: from [10.98.28.8] (helo=KAPPEX023.united.domain) by mrint.1and1.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <kai.lehmann@1und1.de>) id 1q1PWl-0004sy-0m for httpapi@ietf.org; Tue, 23 May 2023 12:46:03 +0200
From: Kai Lehmann <kai.lehmann@1und1.de>
To: "httpapi@ietf.org" <httpapi@ietf.org>
Thread-Topic: [httpapi] Interface to inform client about supported content types
Thread-Index: AQHZjIDxWjbQzpgSYEOxyFAOsEsWTK9mEF+AgABDRgCAAIOuAIAA1zKA
Date: Tue, 23 May 2023 10:46:02 +0000
Message-ID: <A42C5BF5-09D9-4DAD-B7DE-D41CD74BB965@1und1.de>
References: <51E7434D-087B-420B-A459-91F18068C74B@1und1.de> <e53bd068-429a-e714-64db-bb0b906565e6@bucksch.org> <CAPW_8m4FPqJKjkS_YgP3wsBh__YdK1kfZONpxPSC07Bjje9dmw@mail.gmail.com> <9847EA46-31FF-427A-86D8-4D450FEB58D7@mnot.net>
In-Reply-To: <9847EA46-31FF-427A-86D8-4D450FEB58D7@mnot.net>
Accept-Language: en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/16.73.23051401
x-originating-ip: [10.98.28.55]
Content-Type: text/plain; charset="utf-8"
Content-ID: <CCC419808DAAB943BB715E1124552875@united.domain>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-Virus-Scanned: ClamAV@mvs-ha-bs
Archived-At: <https://mailarchive.ietf.org/arch/msg/httpapi/5bE_2Gl0xrXyTsLY7f6-nurOBeg>
Subject: Re: [httpapi] Interface to inform client about supported content types
X-BeenThere: httpapi@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Building Blocks for HTTP APIs <httpapi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/httpapi>, <mailto:httpapi-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/httpapi/>
List-Post: <mailto:httpapi@ietf.org>
List-Help: <mailto:httpapi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/httpapi>, <mailto:httpapi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 23 May 2023 10:46:09 -0000
Thanks everyone for your replies and suggestions. Good to hear that there may be something in the future to use. If I understand the draft mentioned by Mark correctly, the server could provide the information of supported content-types in POSTs with a specific Avail header (not defined yet) like so?: Vary: Content-Type Avail-Content-Types: application/vnd.mytype.v1; application/vnd.myextendedtype.v1 I also stumbled upon the Accept-Post response header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Post) which is not part of an RFC yet as far as I can see. Kai On 23.05.23, 01:56, "httpapi on behalf of Mark Nottingham" <httpapi-bounces@ietf.org <mailto:httpapi-bounces@ietf.org> on behalf of mnot=40mnot.net@dmarc.ietf.org <mailto:40mnot.net@dmarc.ietf.org>> wrote: FYI, we're starting to talk about this in the HTTP WG (not adopted yet): https://mnot.github.io/I-D/draft-nottingham-http-availability-hints.html <https://mnot.github.io/I-D/draft-nottingham-http-availability-hints.html> Cheers, > On 23 May 2023, at 2:04 am, mca <mca@amundsen.com <mailto:mca@amundsen.com>> wrote: > > this topic has come up from time to time and i've not seen a solution that gained wide acceptance (pun?). > > back in 2008, i revealed a set of headers (X-Accept-Types, X-Content-Types, and X-Acceptable) that i've been using to help me solve the problem. > > http://amundsen.com/blog/archives/716 <http://amundsen.com/blog/archives/716> > > this might not be an ideal solution but it has worked for me and it might be a seed for a more widely acceptable solution. > > > > > Mike Amundsen > > APIs, Microservices, and Digital Transformation > 7310 Turfway Rd. Suite 550, Florence, KY, 41042 > > +1.859.757.1449 > https://mastodon.social/@mamund <https://mastodon.social/@mamund> > https://zoom.us/j/8593726715 <https://zoom.us/j/8593726715> > http://linkedin.com/in/mamund <http://linkedin.com/in/mamund> > http://b.mamund.com/meetme <http://b.mamund.com/meetme> > http://training.amundsen.com <http://training.amundsen.com> > http://twitter.com/mamund <http://twitter.com/mamund> > > > On Mon, May 22, 2023 at 7:04 AM Ben Bucksch <news@bucksch.org <mailto:news@bucksch.org>> wrote: > Am 22.05.23 um 09:42 schrieb Kai Lehmann: >> Is there a standard or common practice which allows a server to inform a client about supported content types for a specific resource at runtime? >> Let’s say a server has the resource /myresource and provides several representations which a client can request with the Accept header or send with a POST request: GET /myresource >> Accept: application/vnd.example.content-v1+json POST /myresource >> Content-Type: application/vnd.example.content-extended-v1+json >> ... the actually supported content type is depending on the resource instance and can only be determined at runtime. > > Regarding POST, which data types are accepted during an upload, that is an interesting question. I cannot answer that. (An OPTIONS request seems like a good idea to me.) > Regarding the GET responses: Normally, the question doesn't really appear, because the client sends the Accept header (which you mentioned) which lists the content types that the client supports, and the client can also send its preferences. > Most clients need to specifically code support for each content type, i.e. there is specific code in the client that handles a specific content type response. So, the client lists which content types it can understand. And then the server selects the intersection between the types that the client supports, and the types that the server supports, which can be specific to this instance. The server is supposed to honor the preferences that the client sends. If the client can process any kind of file type using third party programs, the client can use "*/*" as accepted content type. For example, if the client would rather have JSON or XML, but you can theoretically save any kind of file type, the client can express that, with a very low preference for "*/*". > I don't really see a scenario which would not be covered by this. If this doesn't work in your case, could you elaborate more on your specific use case? > Kind greetings, > Ben > >> The HTTP RFCs allow for additional payload in the response to an OPTIONS request: >> OPTIONS /myresource >> Accept: application/vnd.example.negotiation-v1+json > > -- > httpapi mailing list > httpapi@ietf.org <mailto:httpapi@ietf.org> > https://www.ietf.org/mailman/listinfo/httpapi <https://www.ietf.org/mailman/listinfo/httpapi> > -- > httpapi mailing list > httpapi@ietf.org <mailto:httpapi@ietf.org> > https://www.ietf.org/mailman/listinfo/httpapi <https://www.ietf.org/mailman/listinfo/httpapi> -- Mark Nottingham https://www.mnot.net/ <https://www.mnot.net/> -- httpapi mailing list httpapi@ietf.org <mailto:httpapi@ietf.org> https://www.ietf.org/mailman/listinfo/httpapi <https://www.ietf.org/mailman/listinfo/httpapi>
- [httpapi] Interface to inform client about suppor… Kai Lehmann
- Re: [httpapi] Interface to inform client about su… Max Maton
- Re: [httpapi] Interface to inform client about su… Alexander Zeitler
- Re: [httpapi] Interface to inform client about su… Ben Bucksch
- Re: [httpapi] Interface to inform client about su… mca
- Re: [httpapi] Interface to inform client about su… Mark Nottingham
- Re: [httpapi] Interface to inform client about su… Kai Lehmann
- Re: [httpapi] Interface to inform client about su… Alexander Zeitler
- Re: [httpapi] Interface to inform client about su… Evert Pot
- Re: [httpapi] Interface to inform client about su… Mark Nottingham