A Publisher ("example") may have their APIs hosted across multiple
domains that they manage, e.g., at www.example.com
,
developer.example.com
, apis.example.com
,
apis.example.net
, etc. They may also use a third-party API
hosting provider that hosts APIs on a distinct domain.¶
To account for this scenario, it is RECOMMENDED that:¶
-
The Publisher also publish the api-catalog well-known URI at each
of their API domains, e.g., https://apis.example.com/.well-known/api-catalog
,
https://developer.example.net/.well-known/api-catalog
, etc.¶
-
An HTTPS GET request to any of these URIs returns the same result,
namely, the API catalog document.¶
-
The Publisher choose one of their
instances of /.well-known/api-catalog as a canonical reference to
the location of the latest API catalog since the physical location of the API catalog document is decided by the Publisher and may change. The Publisher's other
instances of /.well-known/api-catalog should redirect to this
canonical instance of /.well-known/api-catalog to ensure the latest
API catalog is returned.¶
For example, if the Publisher's primary API portal is
https://apis.example.com
, then
https://apis.example.com/.well-known/api-catalog
should resolve to
the location of the Publisher's latest API catalog document. If the
Publisher is also the domain authority for www.example.net
,
which also hosts a selection of their APIs, then a request to
https://www.example.net/.well-known/api-catalog
should redirect
to https://apis.example.com/.well-known/api-catalog
.¶
If the Publisher is not the domain authority for www.example.net
,
then the Publisher's API Catalog MAY include a link to the
API catalog of the third-party that is the domain authority for www.example.net
. For example, the API catalog available
at https://apis.example.com/.well-known/api-catalog
may list APIs
hosted at apis.example.com
and also link to the API catalog hosted
at https://www.example.net/.well-known/api-catalog
using the
"api-catalog" link relation:¶
{
"linkset": [
{
"anchor": "https://www.example.com/.well-known/api-catalog",
"item": [
{
"href": "https://developer.example.com/apis/foo_api"
},
{
"href": "https://developer.example.com/apis/bar_api"
},
{
"href": "https://developer.example.com/apis/cantona_api"
}
],
"api-catalog": "https://www.example.net/.well-known/api-catalog"
}
]
}
¶
In cases where a Publisher has a large number of APIs potentially
deployed across multiple domains, two challenges may arise:¶
In both cases, a Publisher may benefit from grouping their APIs,
providing an API catalog document for each group and using the main
API catalog hosted at /.well-known/api-catalog to provide links to
these. For example, a Publisher may decide to group their APIs
according to a business category (e.g., "gaming APIs", "anti-fraud
APIs", etc.), a technology category (e.g., "IOT", "networks", "AI",
etc.), or any other criterion.
This grouping may be implicit where the Publisher has already published
their APIs across multiple domains, e.g., at gaming.example.com
,
iot.example.net
, etc.¶
Section 4.3 shows how the API catalog at
/.well-known/api-catalog can use the api-catalog link relation to
point to other API catalogs.¶
The Publisher SHOULD consider caching and compression
techniques to reduce the network overhead of large API catalogs.¶
Publishers are RECOMMENDED to follow operational best practice when
hosting API catalog(s), including, but not limited to:¶
-
Availability. The Publisher should monitor availability of the API
catalog and consider alternate means to resolve requests to
/.well-known/api-catalog during planned downtime of hosts.¶
-
Performance. Although the performance of APIs listed in an API
catalog can demand high transactions per second and low-latency
response, the retrieval of the API catalog itself to discover those
APIs is less likely to incur strict performance demands. That said,
the Publisher should monitor the response time to fulfil a request
for the API catalog and determine any necessary improvements (as
with any other Web resource the Publisher serves). For large API
catalogs, the Publisher should consider the techniques described in
Section 5.3.¶
-
Usage. Since the goal of the api-catalog well-known URI is to
facilitate discovery of APIs, the Publisher may wish to correlate
requests to the /.well-known/api-catalog URI with subsequent requests
to the API URIs listed in the catalog.¶
-
Current data. The Publisher should include the removal of stale API
entries from the API catalog as part of their API release lifecycle.
The Publisher MAY decide to include metadata regarding legacy API
versions or deprecated APIs to help users of those APIs discover
up-to-date alternatives.¶
-
Correct metadata. The Publisher should include human and/or
automated checks for syntax errors in the API catalog. Automated
checks include format validation (e.g., to ensure valid JSON syntax)
and linting to enforce business rules, such as removing duplicate
entries and ensuring descriptions are correctly named with valid
values. A proofread of the API catalog as part of the API release
lifecycle is RECOMMENDED to detect any errors in business grammar
(for example, an API entry that is described with valid syntax, but
has been allocated an incorrect or outdated description.)¶
-
Security best practice. See Section 8.¶
A Publisher may already utilise an API management framework to
produce their API portfolio. These frameworks typically include the
publication of API endpoint URIs, deprecation and redirection of
legacy API versions, API usage policies and documentation, etc.
The api-catalog well-known URI and API catalog document are intended
to complement API management frameworks by facilitating the discovery
of the framework's outputs -- API endpoints, usage policies, and
documentation -- and are not intended to replace any existing
API discovery mechanisms the framework has implemented.¶
Providers of such frameworks may include the production of an API
catalog and the publication of the /.well-known/api-catalog URI as a
final pre-release (or post-release) step in the release management
workflow. The following steps are recommended.¶
If the /.well-known/api-catalog URI has not been published previously, the framework provider should:¶
-
Collate and check the metadata for each API that will be included
in the API catalog. This metadata is likely to already exist in the
framework.¶
-
Determine which metadata to include in the API catalog following
the requirements set out in Section 4.1 and the
considerations set out in Section 5.¶
-
Map the chosen metadata to the format(s) described in
Section 4.2. The structure suggested in
Appendix A.2 may be followed where only the hyperlinks to APIs are to be
included in the API catalog. Where
possible, the API catalog should include further metadata per the
guidance in Section 4.1; in which case, the structure
suggested in Appendix A can be utilised and
adapted (ensuring compliance to [RFC9264]) to reflect the nature
of the chosen metadata.¶
-
Publish the /.well-known/api-catalog URI following the guidance set
out in Section 2.¶
If the /.well-known/api-catalog URI has previously been published,
the framework provider should:¶
-
Include a step in the release management lifecycle to refresh the
API catalog following any changes in API hyperlinks or published
metadata. This could include placing triggers on certain metadata
fields, so that as they are updated in pre-production on the API
framework, the updates are pushed to a pre-production copy of the API
catalog to be pushed live when the release is published by the
framework.¶