APIANT Inline
Embed Inline
1min
the following code describes how to embed and use inline on your web page \<! the inline ui has a theme file named theme inline {apiant inline key} json on the server if the file is not found the default system theme is used > \<! replace with the domain of your apiant server and your api key > \<script src="https //xxxxx com/appjs/apiant inline js?apiant inline key=yyyyy" type="text/javascript">\</script> \<div id="embed apiant inline">\</div> // when invoked, inline has finished loading and is ready to use function apiant handleinlineloaded() { // an empty tenant uuid represents the root apiant system var objaccount = {tenant uuid "", email "saasuser29\@apiant com", firstname "sally", lastname "alsop", initial password "changeme", timezone "us/eastern"}; // if the account does not exist, it is created // must be called as the first step before using other inline functionality apiant setaccount(objaccount); // apiant getactiveautomations(pagenumberzerobased=0, pagesize= 1, sort="name"); //pagesize of 1 = all, sort can be "name" or "id" // apiant getinactiveautomations(pagenumberzerobased=0, pagesize= 1, sort="name"); //pagesize of 1 = all, sort can be "name" or "id" } // invoked when apiant setaccount() completes function apiant handlesetaccountcomplete(objperson) { if (objperson error) { alert(objperson error); } else { // objperson contains identifying information about the account } } // the user clicked a button on your page that selected a template to install// templates are defined in the "templates" account// automations can be published to the "templates" account via the dashboard gear menu "publish as template" option // template uuids can be obtained from the "templates" account's dashboard gear icon menus // a template may be a collection of multiple automations // collections are defined in the "templates" account, are essentially folders having names that start with "collection " function handlebuttonclick(selected template uuid) { var objtemplate = {template uuid selected template uuid}; // installs and configures the template for use // if configuration is successfully completed, the template is turned on and ready to process data apiant starttemplateconfig(objtemplate); } // invoked when apiant starttemplateconfig() completes function apiant handletemplateconfigcomplete(objresult) { if (objresult error) { alert(objresult error); } } // invoked when apiant getactiveautomations(pagenumberzerobased=0, pagesize= 1, sort="name") completes function apiant handlegetactiveautomationscomplete(objresult) { if (objresult error) { alert(objresult error); } else { var jsonobj = json parse(objresult json) } } // invoked when apiant getinactiveautomations(pagenumberzerobased=0, pagesize= 1, sort="name") completes function apiant handlegetinactiveautomationscomplete(objresult) { if (objresult error) { alert(objresult error); } else { var jsonobj = json parse(objresult json) } } // invoked when apiant turnautomationon(automation uuid) or apiant turnautomationoff(automation uuid) completes function apiant handleturnautomationonoffcomplete(objresult) { if (objresult error) { alert(objresult error); } else if (objresult subscription error) { alert(objresult subscription error); } }