Reputation: 601
From my understanding by Googling the 403 error means the API key is right but access is forbidden? But I'm not really 100% sure what that means or how to resolve it.
Below is my code that triggers when I press a button (I've manually added the contact data for testing).
Any help is greatly appreciated.
My code:
$.ajax({
async: true,
crossDomain: true,
url: 'https://myactivehost.api-us1.com/api/3/contacts',
method: 'POST',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'Api-Token': 'myAPIkey'
},
processData: false,
data: '{"contact":{"email":"[email protected]"}}',
success: function() {
console.log('success');
},
error: function() {
console.log('failed');
}
});
Upvotes: 4
Views: 531