Hi Knack Community! I have been developing apps for my company for the past 6 months and have recently started using view based requests instead of object based ones as they seem to be more secure, or so I thought.
A few months ago my Ajax view based requests were happy with only these headers:
var headers = {
'Authorization': Knack.getUserToken(),
'X-Knack-Application-Id': Knack.application_id,
'Content-Type': 'application/json'
};
But recently (past two weeks or so) knack has started giving me āError 400 - Invalid API Keyā,
Adding The APi Key fixes this but only if i put the actual api key. Itās not happy with just āknackā as the documentation says. It seems to be on select apps at the moment but it seems to be spreading to the once working apps requiring me to go back and add the key.
Am i the only one experiencing this? Is there something i am missing?
API keys obscured for security as these apps hold sensitive data.
hereās an example of a whole ajax request that seems to require the api key;
function getData(){
return new Promise((resolve, reject) => {
var headers = {
'Authorization': Knack.getUserToken(),
'X-Knack-Application-Id': Knack.application_id,
'X-Knack-REST-API-KEY':'a0000000-0000-0000-0000-00000000000b',
'Content-Type': 'application/json'
};
$.ajax({
url:'https://api.knack.com/v1/pages/scene_3/views/view_4/records/',
type: 'GET',
headers: headers,
success: function (response) {
resolve(response);
} ,
error: function (error) {
reject(error);
},
});
});
}
and this one seems to be happy without the API Key;
function getSchedType(id){
return new Promise((resolve, reject) => {
var headers = {
'Authorization': Knack.getUserToken(),
'X-Knack-Application-Id': Knack.application_id,
'Content-Type': 'application/json'
};
$.ajax({
url:'https://api.knack.com/v1/pages/scene_10/views/view_15/records/'+id,
type: 'GET',
headers: headers,
success: function (response) {
console.log(response);
resolve(response);
} ,
error: function (error) {
reject(error);
},
});
});
}
Any help appriciated, Thanks in advanced,
Chris.
P.S: if there is a knack method like āKnack.application_idā for retriving the apps api key where could i find it and how many other knack methods are there?