Run an API call on each product page where the user will just need to make any appropriate selections and enter their zip code to get a rebate estimate on the page.
Initialization
Script tag
NOTE needed only if you use it as a standalone script
<script type="text/javascript" src="https://cdn.encentivizer.com/widgets/ee/ee_widget_api.js"></script>
required parameters
Name | Value |
---|---|
token | Widget Token |
search | DLC / Energy Star Model Number / Product ID / Display Name |
prewatts | Existing Wattage, optional for initialization, MUST be positive |
prehours | Existing Hours, optional for initialization, MUST be positive |
regular browser integration
var ee_api = new EEWidgetAPI({
token: 'WIDGET_TOKEN', search: 'SEARCH_QUERY', prewatts: 000, prehours: 0000
});
RequireJS integration
require(["jquery", "ee_widget_api"], function($) {
var ee_api = new EEWidgetAPI({
token: 'WIDGET_TOKEN', search: 'SEARCH_QUERY', prewatts: 000, prehours: 0000
});
});
Functions
1. Settings
This method is used to update the base settings for widget API
required parameters
Name | Value |
---|---|
token | Widget Token |
search | DLC / Energy Star Model Number / Product ID / Display Name |
prewatts | Existing Wattage, MUST be positive |
prehours | Existing Hours, MUST be positive |
Example
ee_api.settings({
token: 'WIDGET_TOKEN', search: 'SEARCH_QUERY', prewatts: 000, prehours: 0000
});
2. Categories
This method is used to fetch available categories
Example
ee_api.categories().done(function(data) {
console.log(data);
});
Returns
[
{
name: "DLC/Energy Star Category"
prehours: 0000
prewatts: 0000
value: "Encentivizer Category Abbreviation"
},
...
]
3. Utilities
This method is used to fetch available utility ids (rendered html options) based on zip provided
required parameters
Name | Value |
---|---|
(token) | (Widget Token, MUST set through initialization/settings) |
zip | Zipcode |
optional parameter
Name | Value |
---|---|
format | 'json' |
example
ee_api.utilities({ zip: 00000 }).done(function(data) {
console.log(data);
});
ee_api.utilities({ zip: 00000, format: 'json' }).done(function(data) {
console.log(data);
});
returns
<option value="...">...</option>
...
<option value="...">...</option>
or
[
{
program: 'PROGRAM_NAME',
utilities: [
{
id: 0000,
name: 'UTILITY_NAME',
eiacode: "00000",
state: 'XX',
commercialrate: 0.0,
program_name: 'PROGRAM_NAME'
},
...
]
},
...
]
4. Rebates
This method is used to fetch rebates based on zipcode and utility provided
required parameters
Name | Value |
---|---|
(token) | (Widget Token, MUST set through initialization/settings) |
(search) | (DLC / Energy Star Model Number / Product ID / Display Name, MUST set through initialization/settings) |
(prewatts) | (Existing Wattage, MUST set through initialization/settings) |
(prehours) | (Existing Hours, MUST set through initialization/settings) |
zip | Zipcode |
utility | Utility ID |
midstream | true:false (Optional parameter, if omitted, false) |
example
ee_api.rebates({ zip: 00000, utility: 0000 }).done(function(data) {
console.log(data);
});
return
{
data: [{
caps: [],
cct: "0",
classification: "DLC-Premium" / "DLC-Standard" / "EnergyStar",
control_rebate: "$0",
cutsheet_link: "https://",
dlc_cutsheet_link: "http://",
efficacy: 0,
has_integral_controls: "YES" / "NO",
image_link: "http://",
lumen: 0.00,
manufacturer_rebate: "$0",
more_info: "http://",
notes: "N/A",
product: "XXXXX-XXXXX",
product_category: "",
product_description: "",
product_id: "",
product_page_link: "https://",
product_type: "",
rebate: "$0",
units: "",
wattage: 0.0,
}, ...],
input_errors: [],
program_rebate_cap: ""
}