Create and configure analytics applications
Combine /config/apps, /appedit, and /config/folders requests to create an application, upload its configuration, and associate it with a folder.
The following sample JSON defines an application named New AppEdit Test.
{
"Technologies": {
"Technologies-RD": {
"New AppEdit Test": {
"created": "2017-10-10",
"defaultscoretype": "Hit/Miss",
"enabled": "on",
"folders": [
"AutoTests"
],
"template": "custom"
}
}
}
}When programmatically creating an application, populating it, and binding it to a folder, you must create the application before you can do either of the other two tasks. The next sample shows the JSON that associates a folder with the application that was defined previously.
{
"Technologies": {
"Technologies-RD": {
"AutoTests": {
"apps": [
"New AppEdit Test"
],
"custom_meta": [],
"modelchan0": "eng1:callcenter",
"modelchan1": "spa1:callcenter",
"nspeakers": 2,
"servers": [
"asrsrvr1",
"asrsrvr8"
]
}
}
}
}The next sample shows an abbreviated version of the JSON configuration of an application.
{
"Sample Top Level Category": {
"phrases": {
"+": {
"all": [
"phrase usually found in all calls of this category"
]
},
"-": {
"all": [
"phrase that shouldn't occur in calls of this category"
]
}
},
"subcategories": {
"Sample 2nd Level Category": {
...
},
"Sample 2nd Level Leaf Category": {
...
}
}
},
"Sample Top Level Leaf Category": {
"phrases": {
...
},
"subcategories": {}
}
}Once you have JSON that provides information about these three aspects of an application, you can create the application, bind it to a folder, and define its configuration with three cURL calls like the following:
-
Calls the
/config/appsendpoint to create the application, using the contents of the fileapp-definition.json.curl -s -X POST -H "Content-Type:application/json" "http://example.company.com:3000/config/apps?token=$token" --data @app-definition.json -
Calls the
/config/foldersendpoint to associate the new application with a specified folder, using the contents of the fileapp-folder-binding.json.curl -s -X POST -H "Content-Type:application/json" http:///example.company.com:3000/config/folders?token=$token" --data @app-folder-binding.json -
Calls the
/appeditendpoint to upload the configuration of the application, using the contents of the fileapp-configuration-sample.json.curl -s -X POST -H "Content-Type:application/json" "http:///example.company.com:3000/appedit/Technologies/Technologies-RD/AppEdit%20Test?token=$token" --data @app-configuration-sample.json
While cURL provides a quick way to use and test REST APIs, and shell scripts are a quick and convenient way of automating many tasks, it is typically faster in the long run to call APIs from applications. The next topic discusses how to use the /appedit API from within applications that are written in the Python programming language.
