Input API function
Before using the functions on this page, you may find it useful to review the following information:
The list of all functions is here.
Description of this function |
|
---|---|
List of functions |
|
OnLoadSampleCase()
– Load a case function
This JavaScript function does not directly use the API. It in used in API Test View to load a sample case JSON file into the DOM and display it to the user, to help visualise the use of the API.
function OnLoadSampleCase() {
$("#resultjson").show().html(JSON.stringify(sampleCase, null, 2));
$("#apiresult").html("Sample case loaded.");
}
/service/pushCase
function – Push a new or existing case
Getting a case returns the JSON in the same format as is used when pushing a case, hence this can be useful for testing. If you want to round trip, you would first push the case then get the case and compare the JSON returned with what was submitted. If pushing a new case, the caseId
value should be null.
function OnPushCase() {// Test 7
var caseId = $('#newcaseid').val();
var url = '/service/pushcase';
if (caseId)
url += '?caseId=' + caseId;
var data = JSON.parse($("#resultjson").html());
OnGetJson(url, data);
}
/service/getBaseCase
function – Get a case
This retrieves the current case as set by /service/setCase
. It returns JSON in the new API format.
function OnGetExistingCase() {// Test 8
OnGetJson('/service/getbasecase');
}
/service/getYaml
function – Get a case’s YAML specification
This retrieves the current case as set by /service/setCase
in YAML format.
function OnGetYaml() {// Test 8
window.location = _baseUrl + "/service/getyaml?id=" + _uuid;
}