- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2016 11:03 AM
When using scripted REST messages, is it possible to have it use the default MID server or to specify a capability if you have multiple MID servers. The setMIDServer method description sounds like I need to specify a specific MID server by name.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 08:28 AM
Hi Robert,
Then may be something like this would be useful for you
var gr = new GlideRecord('ecc_agent_capability_m2m');
gr.addQuery("capability", "REST");
gr.query();
while(gr.next()) {
if(gr.agent.status == "Up") {
gs.log("Available Mid Servers" + gr.agent.name);
}
}
If you are using Rest message in a client script then you might have to create a script include make a ajax call for the above script.
You can return the first agent name that is active and that should take care. You might have to add the rest capability to the mid server for this code to work.
Hope it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2017 08:54 AM
The MIDServerSelector class gives you a hook into the the algorithm to select mid servers based on IP Ranges and Capabilities. This might provide more stable behavior as you migrate to clusters or otherwise complicate your mid server selection configuration.
