var headers = {"Authorization": "Basic <%= encode(iparam.api_key) %>"};
var options = { headers: headers, body: "Hello world"};
var url = "https://newaccount1633786790718.freshdesk.com/api/v2/tickets/6.json";
client.request.put(url, options).then (
function(data) {
console.log(data);
},
function(error) {
console.log(error);
});
I saw other solutions in the forum like reauthenticate the credentials but not worked for me,
Tried another code
var headers = {"Authorization": "Basic <%= encode(iparam.api_key) %>"};
client.request.put("https://newaccount1633786790718.freshdesk.com/api/v2/tickets/6",{'name':'hello'},headers).then (
function(data) {
console.log(data);
},
function(error) {
console.log(error);
});
Above code throws the error like **staus:401, headers: {…}, response:
'{"code":"invalid_credentials","message":"You have to be logged in to perform this action."}', attempts: 1, errorSource: 'APP'}
checked with “whitelisted-domains” in the manifest file but error not solved