change REST server at runtime

change REST server at runtime

  

Is it possible to dynamically change which server to connect to when using a REST API using local information? 

What I mean is: I know you can change the request using the "OnBeforeRequest" action, but that is a server action that doesn't allow for inputs, which means you can only access remote databases.

In my case, I need the user to input which server to connect to at runtime

Solution

I found a way. i'll leave it here in case someone needs it.

It was actually pretty simple, I added a header to the request with the actual server I wanted to connect to. Then, in the OnBeforeRequest action I cycled through the headers and changed the Response.BaseURL based on the value of that header.

Solution