The expected behavior is to have shared logic and query among different server endpoints without needing to repeat the setup and writing repeated code just because the URL endpoint changed.
Steps:
There seems to be no way to configure a dynamic URL for REST API resources at this moment.
Details:
We have multiples servers internally. All the servers shared same resources endpoint, but the URL and authentication are different. It is important for us to be able to connect to these different servers and test them with UI. The management overhead is large because for every new server, we have to duplicate all the existing query and logic. Making the project very hard to manage.
Welcome to the community, @boondoge! Thanks for joining us in Office Hours the other week, as well.
I can't remember if I mentioned this at the time or not, but one thing you can do is configure a new REST API resource without any base URL. This would allow you to dynamically construct the URL - including both the domain and path - when writing each query. Do you see any drawbacks to this approach?
You also mention that the authentication pattern is different for each of these servers, which may be more difficult to configure. Can you expand a bit on what aspect would need to be dynamic?
Hi @Darren . I am Lin, working with @boondoge on this topic.
In our use case, each server has its own key for authentication. All the the server share the same resource endpoint, and our UI component use the same logic. The only difference would be where to request for the resource. Because of that, we need to have dynamic URL.
We might be able to use the approach you suggested. My concern following this approach is how should we handle the authentication?
Can you elaborate a bit more on your authentication scheme? Does each server just have a static API key or do you need to request an auth token? The former is a relatively straightforward case in the sense that you can just dynamically add the appropriate headers within each query.