I am having some difficulty figuring out the best way to achieve maintaining a single rest configuration for an in house service which has multiple servers running. We have a load balancer in place but authentication is on a per server basis. I know which server I have gotten authentication from and I then want to execute the operations against that server. It seems like the transient rest host / operation is the way to go but I don't think I am quite grasping how to implement this from the sample workflow I see that utilizes the transient rest host. The description of the transient rest operation sounds like what I want to use. I do appear to have something that is working but I want to make sure I've done it correctly. Here is my code:
var tmpHost = restHost;
var transientRestHost = RESTHostManager.createTransientHostFrom(tmpHost);
transientRestHost.url = baseUrl;
var theOperation = transientRestHost.addOperation(restOperation);
var request = theOperation.createRequest(inParamtersValues, null);
So in the above code restHost is a REST host I have defined in the plugin.
baseUrl is a new base Url which I get along with my authentication toke.
restOperation is one of the operations I have defined along with that restHost in the plugin
At no point am I making use of the RESTHostManager.createTransientOperationFrom function of the REST Manager. I mucked around with it but couldn't seem to get anything working. The above code seems to work but I am wondering if it is overkill. From the description of the transientRestOperation it sounded like what I wanted. Running the operation with a modified base url but I can't figure out how i would pass that information in.