Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
List namespaces in the index #1283
This is an alternate approach to #577 that we discussed.
Right now, we have the ability to take a site and discover whether it has the API enabled (and where it is). From there, you can see what routes are available on the site, but you can't actually tell what the site supports. For example, how do I know if the site has WooCommerce enabled? How do I know what versions of the API are supported?
In #577, we talked about a possible solution to this, which is to list out the core objects and where they're available in the API. This would allow for some feature detection based on what objects are available. However, this makes it a bit of a pain to actually use, since you still might not be able to understand the API. It doesn't really solve the core problem of discovery.
This PR tackles it from a different angle, and uses the new concept of namespaces that we have in version 2. The index now contains a list of the available namespaces, and namespaces each have their own index (that you can override with your own index if needed). This allows for simple feature detection.
Let's say we later come out with version 3 of the REST API, and you want to assess what's available on the site. You can grab the index and check
You could do the same for checking for plugins. Simply check
I see how the namespaces are listed in the index (pasted below), and that is great for external clients. I am asking if it would make sense to include a public
Actually! Worth mentioning that