Orchestrator API v2 (GET)
{server}/api/v2/?key=[keyvalue]
Description
Returns the port in use by the ScriptX.Services for Windows PC instance registered with the keyvalue.
Applies to:
- Built-in ScriptX.Services for Windows PC (2.18.0 and later) - the key is ignored and the instance port is returned.
- Orchestrator as a Service (2.0.0 and later).
Response model
ServiceDescription {
HttpPort (integer)
}
ServiceDescription:
- HttpPort (integer)
- The port number being used by ScriptX.Services for Windows PC that registered with the matching key value.
Please note the non-standard capitalisation of "HttpPort".
Example usage
Request
<h5>Response <span id="response-status"></span></h5>
<textarea id="response" readonly="readonly" rows="3" class="codefont"></textarea>
<h5>Response headers</h5>
<textarea id="headers" readonly="readonly" rows="3" class="codefont"></textarea>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {
document.getElementById('btn_runcode').addEventListener('click', function() {
callServer(document.getElementById("keyValue"));
});
});
function callServer(key) {
document.getElementById('response-status').textContent = "(waiting)";
fetch("http://127.0.0.1:41190/api/v2/?key="+key)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok: ' + response.statusText);
}
document.getElementById('response-status').textContent = '(status: '
+ response.status + ' ' + response.statusText + ')';
response.json().then(data => {
document.getElementById('response').value = JSON.stringify(data, null, " ");
});
return response.headers;
})
.then(headers => {
let headersText = "";
for (let pair of headers.entries()) {
headersText += `${pair[0]}: ${pair[1]}\n`;
}
document.getElementById('headers').value = headersText;
})
.catch(error => {
document.getElementById('response-status').textContent = '(error: ' + error.message + ')';
document.getElementById('response').value = "Failed to fetch data.";
});
}
</script>
Key (use PUT sample to add a key):