<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="rfc7991bis.rnc"?>
<!-- <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?> -->
<!DOCTYPE rfc [
<!ENTITY nbsp   "&#160;">
<!ENTITY zwsp   "&#8203;">
<!ENTITY nbhy   "&#8209;">
<!ENTITY wj     "&#8288;">
]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std" docName="draft-smith-api-catalog-02" ipr="trust200902"  obsoletes="" updates="" submissionType="IETF" xml:lang="en" version="3">
	<front>
		<title abbrev="api-catalog">api-catalog: A well-known URI to help discovery of APIs</title>
		<seriesInfo name="Internet-Draft" value="draft-smith-api-catalog-02"/>
		<author fullname="Kevin Smith" initials="K" role="editor" surname="Smith">
			<organization>Vodafone</organization>
			<address>
				<postal>
					<street>One Kingdom Street</street>
					<city>London</city>
					<code>W2 6BY</code>
					<country>GB</country>
				</postal>
				<email>kevin.smith@vodafone.com</email>
				<uri>www.vodafone.com</uri>
			</address>
		</author>
		<date year="2023" month="" day=""/>
		<!-- https://authors.ietf.org/en/rfcxml-vocabulary#date -->
		<area>General</area>
		<workgroup>Internet Engineering Task Force</workgroup>
		<keyword>well-known</keyword>
		<keyword>API</keyword>
		<abstract>
			<t>This document defines the "api-catalog" well-known URI. It is intended to facilitate discovery of the APIs published by a Web host.</t>
		</abstract>
	</front>
	<middle>
		<section>
			<!-- The default attributes for <section> are numbered="true" and toc="default" -->
			<name>Introduction</name>
			<t>A Web host may publish Application Programming Interfaces (APIs) to encourage requests for interaction from  external parties. Such APIs must be discovered before they may be used - i.e., the external party needs to know what APIs a given Web host exposes, including their purpose, any constraints to use, and the endpoints to interact with the APIs. To faciliate discovery of this information, this document proposes a well-known URI, 'api-catalog', as a location where a Web host's API endpoints are listed and described.</t>
			<section anchor="goals">
				<name>Goals and non-goals</name>
				<t>The primary goal is to facilitate the discovery of both a Web Host's public API endpoints, and metadata that informs the potential API client of the purpose of each API and any constraints around usage.</t>
				<t>Non-goals: this document does not mandate paths for API endpoints. i.e., it does not mandate that my_example_api should be available at example.com/.well-known/api-catalog/my_example_api (although it is not forbidden to do so).</t>
			</section>
			<section anchor="requirements">
				<name>Requirements Language</name>
				<t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 
					<xref target="RFC2119"/> when, and only when, they appear in all capitals, as shown here.
				</t>
			</section>
		</section>
		<section>
			<name>Using the 'api-catalog' well-known URI</name>
			<t>The api-catalog well-known URI is intended for HTTP(S) servers that publish APIs and wish to facilitate their discovery. Since the purpose of the api-catalog well-known URI is to facilitate API discovery with minimal prior knowledge, it is recommended that /.well-known/api-catalog be hosted at a predictable hostname, i.e. www.example.com . It may also be hosted at other hostnames, e.g. api.example.com, developer.example.com etc.</t>
			<t>A Web host (example.com) supporting this URI:</t>
			<ul>
				<li>SHALL resolve an HTTP(S) GET request to /.well-known/api-catalog and return a linkset </li>
				<li>SHOULD resolve an HTTP(S) HEAD request to /.well-known/api-catalog with a response including a Link header with the relation(s) defined in 
					<xref target="LINK-RELATION" />.
				
				</li>
			</ul>
		</section>
		<section anchor="MEDIA-TYPE">
			<name>Associated Media type: the api-catalog linkset </name>
			<t>A request to the api-catalog well-known URI SHALL return a linkset <xref target="RFC9264"/> containing an array of links with the link relation "api-bookmarks" and an anchor representing the entity hosting the APIs.   Following each link SHOULD return a machine-readable description of the API with sufficient information to decide if, and understand how, to use the API. (Editor's note: we can recommend the format for this machine-readble description, e.g. https://restdesc.org/)</t>
			<t>Example request:</t>
			<figure>
				<name>api-catalog linkset example</name>
<sourcecode name="api-catalog-linkset" type="JSON">
<![CDATA[
GET .well-know/api-catalog HTTP/1.1
Host: example.com
Accept: application/linkset+json

HTTP/1.1 200 OK
Date: Mon, 01 Jun 2023 00:00:01 GMT
Server: Apache-Coyote/1.1
Content-Type: application/linkset+json

{
"linkset": [{
	"anchor": https://example.com/,
	"api-bookmarks": [{
		"href": https://developer.example.com/apis/foo_api
	}, {
		"href": https://developer.example.com/apis/bar_api
	}, {
		"href": https://developer.example.com/apis/cantona_api
	}
	]
}]
}
]]>
</sourcecode>
			</figure>
		</section>
		<section anchor="LINK-RELATION">
			<name>Link relations</name>
			<t>"api-catalog" . A list of one or more machine-readable API bookmarks published by the Web host. </t>		
			<t>"api-bookmarks" . A collection of API bookmarks. Each bookmatk may be followed to obtain a machine-readable description of each API. (Editor's note: not sure if it's better to have an array of links under "api-bookmarks", or an array of links each with their own anchor,  and individual link relation of "api-bookmark")</t>
		</section>
		<section>
			<name>Conformance to RFC8615</name>
			<t>The requirements in section 3 of <xref target="RFC8615" /> for defining Well-Known Uniform Resource Identifiers are met as follows:</t>
			<section>
				<name>Path prefix</name>
				<t>The api-catalog URI SHALL be appended to the /.well-known/ path-prefix for "well-known locations".
				</t>
			</section>
			<section>
				<name>Supported URI schemes</name>
				<t>The api-catalog well-known URI may be used with the HTTP and HTTPS URI schemes.</t>
			</section>
			<section>
				<name>Registration of the api-catalog well-known URI</name>
				<t>See 
					<xref target="IANA"/> considerations below.
				</t>
			</section>
		</section>
		<section anchor="IANA">
			<name>IANA Considerations</name>
			<section>
				<name>The api-catalog well-known URI</name>
				<t> This specification registers the "api-catalog" well-known URI in the Well-Known URI Registry as defined by 
					<xref target="RFC6415"/> .
				</t>
				<t>URI suffix: api-catalog</t>
				<t>Specification document(s):  draft-smith-api-catalog-02</t>
				<t>Related information:  The "api-catalog" documents obtained from the same host using the HTTP and HTTPS protocols (using default ports) MUST be identical.</t>
			</section>
			<section>
				<name>The api-catalog link relation</name>
				<t> This specification registers the "api-catalog" link relation by following the procedures per section 4.2.2 of 
					<xref target="RFC8288"/>  (Editor's note: this is TODO).
				</t>
			</section>
			<section>
				<name>The api-bookmarks link relation</name>
				<t> This specification registers the "api-bookmarks" link relation by following the procedures per section 4.2.2 of 
					<xref target="RFC8288"/>  (Editor's note: this is TODO).
				</t>
			</section>
		</section>
		<section anchor="Security">
			<!-- All drafts are required to have a security considerations section. See RFC 3552 for a guide. -->
			<name>Security Considerations</name>
			<t>TBD</t>
		</section>
	</middle>
	<back>
		<references>
			<name>References</name>
			<references>
				<name>Normative References</name>
				<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6415.xml"/>
				<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8288.xml"/>				
				<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8615.xml"/>				
				<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9264.xml"/>
			</references>
			<references>
				<name>Informative References</name>
				<reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
					<!-- Manually added reference -->
					<front>
						<title>Key words for use in RFCs to Indicate Requirement Levels</title>
						<author initials="S." surname="Bradner" fullname="S. Bradner">
							<organization/>
						</author>
						<date year="1997" month="March"/>
						<abstract>
							<t>In many standards track documents several words are used to signify the requirements in the specification. 
							These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. 
							This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.
              </t>
						</abstract>
					</front>
					<seriesInfo name="BCP" value="14"/>
					<seriesInfo name="RFC" value="2119"/>
					<seriesInfo name="DOI" value="10.17487/RFC2119"/>
				</reference>
			</references>
		</references>
		<section anchor="Acknowledgements" numbered="false">
			<!-- an Acknowledgements section is optional -->
			<name>Acknowledgements</name>
			<t>TODO</t>
		</section>
	</back>
</rfc>