JSON SDK Helper
Issue
The TotalAgility SDK can be called via JSON, however you must craft the JSON request manually by looking at the parameters in the API documentation. This is tedious and easily leads to mistakes when calling more complicated API functions.
Solution
KTA Package: JsonSdkHelper.zip
The included form allows selecting any KTA API function to provide a correctly formatted JSON request. Edit as needed and test calling the function.
This is intended to programmatically create structurally correct JSON requests for API functions to avoid structure and spelling mistakes inherent in the tedious process of hand-crafting JSON by looking at documentation.
This does not necessarily mean these auto generated requests are valid for the actual API as-is. Refer to API documentation for the specific function for actual valid parameter combinations and values.
Usage
- Import the attached package (check the Overwrite option in case of a previous version)
- In the workspace, open JsonSdk.form
- Select SDK Service and function to generate JSON
- Edit request JSON as needed and click to call client side through JavaScript, or server side through .NET HttpClient.
Simple Example
- For SDK Service, select TotalAgility.Sdk.UserService
- For Function, select GetLoggedOnUsers2
- This function is ready to use as-is because it only takes a session ID parameter, which is generated pre-populated
- Click either of the call buttons to see the API response
Elaborate Example
- For SDK Service, select TotalAgility.Sdk.JobService
- For Function, select GetJobs4
- This function takes an elaborate filter object that can have several types of nested objects, so the generated request is quite long.
- Calling as-is results in an error, and you would need to use the documentation to determine what parameters are required and what values to those parameters are valid and logical.
- Despite the large number of possible parameters on the filter object, a valid request can be made by replacing the whole filter object with just the following:
"jobFilter": { "MaxNumberToRetrieve": 1 }
Technical Details
Because the function lists are programmatically generated, they include all functions even if undocumented. However these should not be used because only documented functions are supported.
The auto generated JSON request has parameters set to default values for the data type, with the following additions:
• Collection types have one item of that type added
• DateTime is set to the current moment
• sessionId parameters are automatically populated with a session ID
Level of Complexity
Moderate
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
Kofax TotalAgility | 7.10 7.9 7.8 7.7 7.6 7.5 |
ALL | ALL | N/A |