Is it ok for an endpoint to be located at /path/ instead of /

All the examples assume the JSON:API to be located at /, but I have not found a specific requirement for this in the spec.

Background: We have a server that connects to multiple databases. We’d like to expose this data via JSON:API and the obvious design choice would be to include the database name in the URL, essentially creating one API for each DB.

JSON:API doesn’t make any assumptions about the URLs at all, though the examples follow a particular pattern. There’s an expectation that some URLs are provided via documentation, and all other URLs are returned in responses. The idea is really that a client shouldn’t be computing URLs.

It’s entirely reasonable to expose all JSON:API endpoints below a particular URL path, such as /path/ or /api/.


1 Like