Hello,
I just started working with custom Apps for Freshservice and am currently trying set up a very simple installation page with validation of the API key. To validate the key I am trying to use request methods, but no matter what I do, I get “error while substituting templates.”. Here the console output:
My code is as follows:
iparams.json
{
"api_key": {
"display_name": "API Key",
"description": "Please enter your API key",
"type": "api_key",
"secure": true,
"required": true,
"data-bind": "product.api_key",
"type_attributes": {
"product": "freshservice"
},
"events": [
{
"change": "apiKeyChange"
}
]
}
}
iparams.js
app.initialized().then(
function (_client) {
window.client = _client;
},
function (error) {
//If unsuccessful
console.error(error);
}
);
function apiKeyChange() {
console.log(utils.get("api_key"));
client.request.invokeTemplate("validateAPI").then((response) => console.log(response));
};
requests.json
{
"validateAPI": {
"schema": {
"method": "GET",
"host": "digitale-transformation-fs-sandbox.freshservice.com",
"path": "/api/v2/tickets",
"headers": {
"Authorization": "Basic <%= encode(iparam.api_key) %>",
"Content-Type": "application/json"
}
}
}
}
Could someone help me with this?