Internet-Draft | api-catalog | July 2023 |
Smith | Expires 25 January 2024 | [Page] |
This document defines the "api-catalog" well-known URI. It is intended to facilitate discovery of the APIs published by a Web host.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 25 January 2024.¶
Copyright (c) 2023 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
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 policies for usage, 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.¶
The primary goal is to facilitate the discovery of a Web Host's public API endpoints, along with metadata that describes the purpose and usage of each API. The api-catalog is primarily machine-readable to enable automated discovery and usage of APIs. The api-catalog may also include links to human-readable documentation.¶
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).¶
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 [RFC2119] when, and only when, they appear in all capitals, as shown here.¶
The api-catalog well-known URI is intended for HTTP(S) servers that publish APIs and wish to facilitate their discovery and usage. 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, e.g. www.example.com . It may also be hosted at other hostnames, e.g. api.example.com, developer.example.com etc.¶
A Web host (example.com) supporting this URI:¶
"api-catalog" . Links to an api-catalog as defined in this document.¶
"service-desc" . Defined in [RFC8615], used to link to a description of the API that is primarily intended for machine consumption.¶
"service-doc" . Defined in [RFC8615], used to link to API documentation that is primarily intended for human consumption.¶
"service-meta" . Defined in [RFC8615], used to link to additional metadata about the API, and is primarily intended for machine consumption.¶
"status" . Defined in [RFC8615], used to link to the API status (e.g. API "health" indication etc.) for machine and/or human consumption.¶
A GET request to the api-catalog well-known URI SHALL return a linkset [RFC9264] containing an array of linkset context objects. Each linkset context object MUST include an anchor with a URI reference for an API endpoint, and a "service-desc" link relation. The link relations for "status", "service-doc", "service-meta" MAY be included.¶
Example request:¶
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://developer.example.com/apis/foo_api", "service-desc": [ { "href": "https://developer.example.com/apis/foo_api/spec", "type": "text/n3" } ], "status": [ { "href": "https://developer.example.com/apis/foo_api/status", "type": "application/json" } ], "service-doc": [ { "href": "https://developer.example.com/apis/foo_api/doc", "type": "text/html" } ], "service-meta": [ { "href": "https://developer.example.com/apis/foo_api/policies", "type": "text/xml" } ] }, { "anchor": "https://developer.example.com/apis/bar_api", "service-desc": [ { "href": "https://developer.example.com/apis/bar_api/spec", "type": "application/json" } ], "status": [ { "href": "https://developer.example.com/apis/bar_api/status", "type": "application/json" } ], "service-doc": [ { "href": "https://developer.example.com/apis/bar_api/doc", "type": "text/plain" } ] }, { "anchor": "https://developer.example.com/apis/cantona_api", "service-desc": [ { "href": "https://developer.example.com/apis/cantona_api/spec", "type": "text/n3" } ], "service-doc": [ { "href": "https://developer.example.com/apis/cantona_api/doc", "type": "text/html" } ] } ] }
The requirements in section 3 of [RFC8615] for defining Well-Known Uniform Resource Identifiers are met as follows:¶
The api-catalog URI SHALL be appended to the /.well-known/ path-prefix for "well-known locations".¶
The api-catalog well-known URI may be used with the HTTP and HTTPS URI schemes.¶
This specification registers the "api-catalog" well-known URI in the Well-Known URI Registry as defined by [RFC6415] .¶
URI suffix: api-catalog¶
Specification document(s): draft-smith-api-catalog-03¶
Related information: The "api-catalog" documents obtained from the same host using the HTTP and HTTPS protocols (using default ports) MUST be identical.¶
This specification registers the "api-catalog" link relation by following the procedures per section 4.2.2 of [RFC8288] (Editor's note: IANA registrations are TODO).¶
Relation Name: api-catalog¶
Description: Identifies a catalog of APIs published by the context Web host.¶
Reference: draft-smith-api-catalog-03¶
TODO¶