Orchestrator API v2 (PUT)
{server}/api/v2/?key=[keyvalue]&port=[portvalue]
Description
Registers the port for the given key.
When ScriptX.Services for Windows PC starts it calls this API with its configured keyvalue and the port in use.
Applies to:
- Built-in ScriptX.Services for Windows PC (2.18.0 and later) - the key is ignored.
- Orchestrator as a Service (2.0.0 and later).
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">
$(function () {
$('#btn_runcode').click(function () { getPort($('#keyValue').val()); });
});
function getPort(key) {
$('#response-status').text("(waiting)");
var settings = {
method: "PUT",
cache: false
};
jQuery.ajax("http://127.0.0.1:41190/api/v1/?key="+key, settings)
.done(function (data, textStatus, jqXHR) {
$('#response-status').text(('(status: ' + jqXHR.status + ' ' + jqXHR.statusText + ')'));
$('#response').val(data);
$('#headers').val(jqXHR.getAllResponseHeaders()); // shows response headers in textarea element
})
.fail(function (jqXHR, textStatus, errorThrown) {
$('#response-status').text('(status: ' + jqXHR.status + ' ' + jqXHR.statusText + ')');
});
}
</script>
Key:
(A port value of 41193 will be used)