-
Notifications
You must be signed in to change notification settings - Fork 5
Better configurability of urls [feature request] #4
Description
Currently the only way I can find to add url is via the metaclass.
The problem with this is, when writing software, its often necessary to have dynamic choices in URLs (Ie devel server/production server, or in the case of turnkey systems, there might be a self hosted server somewhere).
Heres neat trick I worked out with Django DRF. My first call to the system is the API root , with the username and password. This returns an error if the auth is on crack, but if the auth succeeds returns a dictionary with endpoint names and urls. So for instance in my current project;-
{
"processchanges": "http://localhost:8000/api/v1/processchanges/",
"annotations": "http://localhost:8000/api/v1/annotations/",
"relationships": "http://localhost:8000/api/v1/relationships/",
"entity": "http://localhost:8000/api/v1/entity/"
}
What would be great is to be able to pass the system a dictionary like the above, and then instead of meta.url="http://localhost:8000/api/v1/processchanges/" have meta.endpoint="processchanges" which could then lookup the dictionary. This also has an even more magical property that those end points dont even have to be on the same server.