This page describes how to call a TotalAgility web service from jquery using JSON.
4 <script src=
"http://code.jquery.com/jquery-1.7.1.min.js"></script>
6 <div id=
"Request"></div>
7 <div id=
"Result"></div>
9 var LogonWithPasswordStruct = function () {
11 "userIdentityWithPassword": {
13 "UnconditionalLogOn": false,
22 var logonJSON = new LogonWithPasswordStruct();
23 logonJSON.userIdentityWithPassword.LogOnProtocol =
"7";
24 logonJSON.userIdentityWithPassword.UnconditionalLogOn = true;
25 logonJSON.userIdentityWithPassword.UserId =
"User1";
26 logonJSON.userIdentityWithPassword.Password =
"xxxxxxxxxx";
28 $(
"#Request").html(
"<BR/><B>Request:</B><BR/>" + JSON.stringify(logonJSON));
30 // Calling method LogOnWithPassword2
34 url:
"http://localhost/TotalAgility/Services/Sdk/UserService.svc/json/LogOnWithPassword2",
35 data: JSON.stringify(logonJSON),
36 contentType:
"application/json; charset=utf-8",
39 success: function (result) {
40 $(
"#Result").html(
"<BR/><B>Response: </B><BR/>" + JSON.stringify(result.d));
42 error: function (jqXHR, textStatus, errorThrown) {
43 alert(
"***Error***\n");
4 <script src=
"http://code.jquery.com/jquery-1.7.1.min.js"></script>
6 <div id=
"Request"></div>
7 <div id=
"Result"></div>
9 var LogOffStruct = function () {
17 var logOffJSON = new LogOffStruct();
18 logOffJSON.sessionId =
"B1B44E3109E6447BB4EEBA578937402B";
20 $(
"#Request").html(
"<BR/><B>Request:</B><BR/>" + JSON.stringify(logOffJSON));
22 // Calling method Logoff
26 url:
"http://localhost/TotalAgility/Services/Sdk/UserService.svc/json/LogOff",
27 data: JSON.stringify(logOffJSON),
28 contentType:
"application/json; charset=utf-8",
31 success: function (result) {
32 $(
"#Result").html(
"<BR/><B>Response: </B><BR/>" + JSON.stringify(result.d));
34 error: function (jqXHR, textStatus, errorThrown) {
35 alert(
"***Error***\n");
4 <script src=
"http://code.jquery.com/jquery-1.7.1.min.js"></script>
6 <div id=
"Request"></div>
7 <div id=
"Result"></div>
9 var InputVariableStruct = function () {
15 "FormattedAsText": null,
23 var CreateJobStruct = function () {
25 "jobInitialization": {
41 var createJobJSON = new CreateJobStruct();
43 var varFirstName = new InputVariableStruct();
44 varFirstName.DisplayName =
"FirstName";
45 varFirstName.Id =
"FIRSTNAME";
46 varFirstName.Value =
"Naresh"; // string
47 createJobJSON.jobInitialization.InputVariables.push(varFirstName);
49 var varLastName = new InputVariableStruct();
50 varLastName.DisplayName =
"LastName";
51 varLastName.Id =
"LASTNAME";
52 varLastName.Value =
"Kokkula"; // String
53 createJobJSON.jobInitialization.InputVariables.push(varLastName);
55 var varLoanApplied = new InputVariableStruct();
56 varLoanApplied.DisplayName =
"LoanApplied";
57 varLoanApplied.Id =
"LOANAPPLIED";
58 varLoanApplied.Value =
"2016-01-05T10:19:00.000Z"; //Date
59 createJobJSON.jobInitialization.InputVariables.push(varLoanApplied);
61 var varAmountRequired = new InputVariableStruct();
62 varAmountRequired.DisplayName =
"AmountRequired";
63 varAmountRequired.Id =
"AMOUNTREQUIRED";
64 varAmountRequired.Value = 25000.00; // Decimal
66 createJobJSON.jobInitialization.InputVariables.push(varAmountRequired);
67 createJobJSON.processIdentity.Id =
"F296FF6FC8794410BAA627093A8A74D3";
68 createJobJSON.processIdentity.Name =
"BP";
69 createJobJSON.processIdentity.Version = 0;
70 createJobJSON.sessionId =
"3F05A05532EA469D8F9FC150A61D5CBB";
72 $(
"#Request").html(
"<BR/><B>Request:</B><BR/>" + JSON.stringify(createJobJSON));
74 // Calling method CreateJob
78 url:
"http://localhost/TotalAgility/Services/Sdk/JobService.svc/json/CreateJob",
79 data: JSON.stringify(createJobJSON),
80 contentType:
"application/json; charset=utf-8",
83 success: function (result) {
84 $(
"#Result").html(
"<BR/><B>Response: </B><BR/>" + JSON.stringify(result.d));
86 error: function (jqXHR, textStatus, errorThrown) {
87 alert(
"***Error***\n");
4 <script src=
"http://code.jquery.com/jquery-1.7.1.min.js"></script>
6 <div id=
"Request"></div>
7 <div id=
"Result"></div>
11 var CreateJobWithDocumentsAndProgress2Struct = function () {
13 "jobWithDocsInitialization": {
14 "InputVariables": null,
15 "RuntimeDocumentCollection": [],
20 "Name":
"", // required
21 "Version": 0.0 // required
23 "variablesToReturn": [],
24 "sessionId":
"" // required
29 var RuntimeDocument = function () {
31 "Base64Data": null, //alternate to passing
'Data'
32 "Data": null, //required byte array, JS Array i.e. [73,73,14 ...] (
not Unit8)
33 "DeleteDocument": false,
34 "DocumentGroup": null,
35 "DocumentTypeId": null,
36 "DocumentTypeName": null,
37 "FieldsToReturn": [], //RunTimefieldIdentityCollection
38 "FilePath": null, //alternate to passing
'Data' (serverSide Path)
41 "MimeType": null, //required
42 "PageDataList": [], // PageDataCollection
43 "PageImages": [], // PageImageDataCollection
44 "ReturnAllFields": true,
45 "RuntimeFields": [] // RuntimeFieldcollection
50 var VariableIdentity = function () {
52 "Id": null, //required
58 var jobJSON = new CreateJobWithDocumentsAndProgress2Struct();
59 jobJSON.sessionId =
"3F05A05532EA469D8F9FC150A61D5CBB";
60 jobJSON.processIdentity.Id =
"DB65BE80231045779AED6D802C2CAD6C";
61 jobJSON.processIdentity.Name =
"Bank - Standard Capture";
63 var rVar = new VariableIdentity();
64 rVar.Id =
"LOT_NUMERISATION";
65 jobJSON.variablesToReturn.push(rVar);
67 var rtd1 = new RuntimeDocument();
69 rtd1.Base64Data =
"<<base64 data would go here>>";
70 rtd1.MimeType =
"image/tiff";
71 rtd1.ReturnAllFields = true;
72 jobJSON.jobWithDocsInitialization.RuntimeDocumentCollection.push(rtd1);
74 var rtd2 = new RuntimeDocument();
75 rtd2.Base64Data =
"<<base64 data would go here>>";
76 rtd2.MimeType =
"image/tiff";
77 rtd2.ReturnAllFields = true;
78 jobJSON.jobWithDocsInitialization.RuntimeDocumentCollection.push(rtd2);
80 $(
"#Request").html(
"<BR/><B>Request:</B><BR/>" + JSON.stringify(jobJSON));
82 // Call CreateJobWithDocumentsAndProgress2 method
86 url:
"http://localhost/TotalAgility/Services/Sdk/JobService.svc/json/CreateJobWithDocumentsAndProgress2",
87 data: JSON.stringify(jobJSON),
88 contentType:
"application/json; charset=utf-8",
91 success: function (result) {
92 $(
"#Result").html(
"<BR/><B>Response: </B><BR/>" + JSON.stringify(result.d));
94 error: function (jqXHR, textStatus, errorThrown) {
95 alert(
"***Error***\n");
4 <script src=
"http://code.jquery.com/jquery-1.7.1.min.js"></script>
6 <div id=
"Request"></div>
7 <div id=
"Result"></div>
10 var GetWorkQueueStruct = function () {
12 "jobActivityFilter": {
19 "EndDueDateTime": null,
22 "MaxActivitiesCount": 100,
23 "StartDueDateTime": null,
24 "StartPendingTime": null,
25 "ActivityTypeFilters": 0,
26 "WorkQueueDefinition": {
35 "ReturnJobIds": false,
36 "UsePrioritySetting": 0,
45 "UseCombinedWorkQueue": false,
46 "UseJobSlaStatus": false,
50 "UseActivitySlaStatus": false,
51 "ActivitySlaStatus": 0,
52 "CaseActivitiesOnly": false,
81 var getWorkQueueJSON = new GetWorkQueueStruct();
82 getWorkQueueJSON.sessionId =
"FA4CAE506A5F49FF90C832BCA311C439";
83 getWorkQueueJSON.jobActivityFilter.MaxActivitiesCount = 100;
84 getWorkQueueJSON.jobActivityFilter.UseCombinedWorkQueue = true;
86 $(
"#Request").html(
"<BR/><B>Request:</B><BR/>" + JSON.stringify(getWorkQueueJSON));
88 // Call GetWorkQueue2 method
92 url:
"http://localhost/TotalAgility/Services/Sdk/ActivityService.svc/json/GetWorkQueue2",
93 data: JSON.stringify(getWorkQueueJSON),
94 contentType:
"application/json; charset=utf-8",
97 success: function (result) {
98 $(
"#Result").html(
"<BR/><B>Response: </B><BR/>" + JSON.stringify(result.d));
100 error: function (jqXHR, textStatus, errorThrown) {
101 alert(
"***Error***\n");
4 <script src=
"http://code.jquery.com/jquery-1.7.1.min.js"></script>
6 <div id=
"Request"></div>
7 <div id=
"Result"></div>
10 var TakeActivityStruct = function () {
13 "jobActivityIdentity":
16 "EmbeddedProcessCount": 0,
27 var takeActivityJSON = new TakeActivityStruct();
28 takeActivityJSON.sessionId =
"FA4CAE506A5F49FF90C832BCA311C439";
29 takeActivityJSON.jobActivityIdentity.NodeId = 1;
30 takeActivityJSON.jobActivityIdentity.EmbeddedProcessCount = 0;
31 takeActivityJSON.jobActivityIdentity.JobId =
"FD871D79AA544328B7EB99A8E42727B9";
33 $(
"#Request").html(
"<BR/><B>Request:</B><BR/>" + JSON.stringify(takeActivityJSON));
35 // Call TakeActivity method
39 url:
"http://localhost/TotalAgility/Services/Sdk/ActivityService.svc/json/TakeActivity",
40 data: JSON.stringify(takeActivityJSON),
41 contentType:
"application/json; charset=utf-8",
44 success: function (result) {
45 $(
"#Result").html(
"<BR/><B>Response: </B><BR/>" + JSON.stringify(result.d));
47 error: function (jqXHR, textStatus, errorThrown) {
48 alert(
"***Error***\n");
4 <script src=
"http://code.jquery.com/jquery-1.7.1.min.js"></script>
6 <div id=
"Request"></div>
7 <div id=
"Result"></div>
10 var CompleteActivityStruct = function () {
12 "jobActivityIdentity":
15 "EmbeddedProcessCount": 0,
21 "jobActivityOutput": {
22 "OutputVariables": [],
31 var completeActivityJSON = new CompleteActivityStruct();
32 completeActivityJSON.sessionId =
"FA4CAE506A5F49FF90C832BCA311C439";
33 completeActivityJSON.jobActivityIdentity.NodeId = 1;
34 completeActivityJSON.jobActivityIdentity.EmbeddedProcessCount = 0;
35 completeActivityJSON.jobActivityIdentity.JobId =
"FD871D79AA544328B7EB99A8E42727B9";
37 $(
"#Request").html(
"<BR/><B>Request:</B><BR/>" + JSON.stringify(completeActivityJSON));
39 // Call TakeActivity method
43 url:
"http://localhost/TotalAgility/Services/Sdk/ActivityService.svc/json/CompleteActivity",
44 data: JSON.stringify(completeActivityJSON),
45 contentType:
"application/json; charset=utf-8",
48 success: function (result) {
49 $(
"#Result").html(
"<BR/><B>Response: </B><BR/>" + JSON.stringify(result.d));
51 error: function (jqXHR, textStatus, errorThrown) {
52 alert(
"***Error***\n");