Embed Inline
The following code describes how to embed and use Inline on your web page:
JS
1<!-- 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. --> 2 3<!-- Replace with the domain of your APIANT server and your API Key --> 4<script src="https://XXXXX.com/appJS/apiant_inline.js?apiant_inline_key=YYYYY" type="text/javascript"></script> 5 6<div id="embed_apiant_inline"></div> 7 8// When invoked, Inline has finished loading and is ready to use 9function apiant_handleInlineLoaded() 10{ 11 // An empty tenant_uuid represents the root APIANT system 12 var objAccount = {tenant_uuid: "", 13 email: "saasuser29@apiant.com", 14 firstname: "Sally", 15 lastname: "Alsop", 16 initial_password: "Changeme", 17 timezone: "US/Eastern"}; 18 19 // If the account does not exist, it is created 20 // Must be called as the first step before using other Inline functionality 21 apiant_setAccount(objAccount); 22 23// apiant_getActiveAutomations(pageNumberZeroBased=0, pageSize=-1, sort="name"); //pageSize of -1 = all, sort can be "name" or "id" 24// apiant_getInactiveAutomations(pageNumberZeroBased=0, pageSize=-1, sort="name"); //pageSize of -1 = all, sort can be "name" or "id" 25} 26 27// Invoked when apiant_setAccount() completes 28function apiant_handleSetAccountComplete(objPerson) 29{ 30 if (objPerson.error) 31 { 32 alert(objPerson.error); 33 } 34 else 35 { 36 // objPerson contains identifying information about the account 37 } 38} 39 40// 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 41// Template UUIDs can be obtained from the "templates" account's dashboard gear icon menus 42// A template may be a collection of multiple automations 43// Collections are defined in the "templates" account, are essentially folders having names that start with "Collection:" 44function handleButtonClick(selected_template_uuid) 45{ 46 var objTemplate = {template_uuid: selected_template_uuid}; 47 48 // Installs and configures the template for use 49 // If configuration is successfully completed, the template is turned on and ready to process data 50 apiant_startTemplateConfig(objTemplate); 51} 52 53// Invoked when apiant_startTemplateConfig() completes 54function apiant_handleTemplateConfigComplete(objResult) 55{ 56 if (objResult.error) 57 { 58 alert(objResult.error); 59 } 60} 61 62// Invoked when apiant_getActiveAutomations(pageNumberZeroBased=0, pageSize=-1, sort="name") completes 63function apiant_handleGetActiveAutomationsComplete(objResult) 64{ 65 if (objResult.error) 66 { 67 alert(objResult.error); 68 } 69 else 70 { 71 var jsonObj = JSON.parse(objResult.json) 72 } 73} 74 75// Invoked when apiant_getInactiveAutomations(pageNumberZeroBased=0, pageSize=-1, sort="name") completes 76function apiant_handleGetInactiveAutomationsComplete(objResult) 77{ 78 if (objResult.error) 79 { 80 alert(objResult.error); 81 } 82 else 83 { 84 var jsonObj = JSON.parse(objResult.json) 85 } 86} 87 88// Invoked when apiant_turnAutomationOn(automation_uuid) or apiant_turnAutomationOff(automation_uuid) completes 89function apiant_handleTurnAutomationOnOffComplete(objResult) 90{ 91 if (objResult.error) 92 { 93 alert(objResult.error); 94 } 95 else if (objResult.subscription_error) 96 { 97 alert(objResult.subscription_error); 98 } 99}