API Discovery #10
Replies: 4 comments 10 replies
-
With my limited technical understanding, I can only call on others. |
Beta Was this translation helpful? Give feedback.
-
Using .well-known for the discovery sounds like a good approach.
|
Beta Was this translation helpful? Give feedback.
-
I think versioning is out of scope here, it will happen after the discovery as you already stated. In my simplified example the versioning would be part of the
Well, there is security.txt at least. Omitting the file type extension introduces some ambiguity I'd like to avoid, I am not settled on json though.
Thats a pretty good one, I'll add this to my draft. What do you think about having some kind of DNS-based discovery as well?
Well, its not about changing the endpoint for us, its about giving server implementations the option to change it while still complying to the spec. This might be needed when there are path clashes or restrictions (for example for Nextcloud Plugins: As far as I am aware the prefix is given). However, this can be fixed with a prefix already and flexible endpoints probably introduce unneeded complexity. |
Beta Was this translation helpful? Give feedback.
-
What do you think of the possibility of absolute addresses alongside relative ones for the prefix? So that all of the following examples would become possible:
(maybe alongside a different name for the field) This could be useful if a service uses a subdomain for the api. It would then only need to share its primary domain and put the |
Beta Was this translation helpful? Give feedback.
-
The problem
We want to allow different software to implement the API. Looking at the server software there might be the case that they already have a API path pattern. If we now define global paths that need to be available for that API, the software might be forced to move away from its schema or applying dirty hacks.
If we for example take the Funkwhale API, all paths start with
/api/v1
. If we now declare endpoints like/openpodcastapi/subscriptions/...
, it might break the pattern.Solution
In order to solve this I'd like to allow the server to either
If the client now wants to call endpoints for a specific server, it needs to discover those endpoints. Therefore we could place a json file inside
.well-kown
containing the prefix or each endpoints URL. (See https://en.wikipedia.org/wiki/Well-known_URI). This would allow the client to fetch those information from a static location using the information to actually talk to the API.Example
Lets say we go the prefix way. The open podcast api specifies the following endpoints (just examples):
/subscriptions
/episodes
Now a random server software implements the API. It places a file
/.well-known/openpodcastapi.json
with the following content:The client can now assemble the actual endpoint URLs:
SCHEMA://HOSTNAME/PREFIX/ENDPOINT
In our example to fetch the subscriptions:
https://some-server.org/api/openpodcast/subscriptions
Open Questions
Beta Was this translation helpful? Give feedback.
All reactions