GET Contact by Email Address Via Client-Side AJAX Request

Hello,

I am attempting to get the contact by email address on the Client-Side of my page that I am creating via an AJAX GET Request. I am having some problems doing that. It appears to be returning a 200 response but throws a “parsererror”. Does anyone have any clue what to do? It doesn’t work with either the DEMO URL or my own URL with my own hapikey, they both return the same results. My code example is below. As well as the Response it gives and the URL to the API Documentation that I am referencing.

https://developers.hubspot.com/docs/methods/contacts/get_contact_by_email

$.ajax({
	method: 'get',
	crossDomain: true,
	url: 'https://api.hubapi.com/contacts/v1/contact/email/testingapis@hubspot.com/profile?hapikey=demo',
	headers: {
		'accept': 'application/json',
		'Access-Control-Allow-Origin':'*'
	},
	contentType: 'application/json; charset=utf-8',
	dataType: 'jsonp',
	processData: true,
	credentials: 'include',
	complete: function (jqXHR, textStatus) {
		console.log(jqXHR);
		console.log(JSON.parse(JSON.stringify(jqXHR)));
		console.log(textStatus);
	},
	error: function (jqXHR, textStatus, errorThrown) {
		console.log(jqXHR);
		console.log(jqXHR.status);
		console.log(textStatus);
		console.log(JSON.parse(JSON.stringify(textStatus)));
		console.log(errorThrown);
	}
});
Error CallbackThe script from “https://api.hubapi.com/contacts/v1/contact/email/testingapis@hubspot.com/profile?hapikey=demo&callback=jQuery33107534809487763269_1550251296155&_=1550251296156” was loaded even though its MIME type (“application/json”) is not a valid JavaScript MIME type.[Learn More]
Object { readyState: 4, getResponseHeader: getResponseHeader(), getAllResponseHeaders: getAllResponseHeaders(), setRequestHeader: setRequestHeader(), overrideMimeType: overrideMimeType(), statusCode: statusCode(), abort: abort(), state: state(), always: always(), catch: catch()
, … }
200
parsererror
parsererror
Error: "jQuery33107534809487763269_1550251296155 was not called"
 jQuery 7Complete Callback
Object { readyState: 4, getResponseHeader: getResponseHeader(), getAllResponseHeaders: getAllResponseHeaders(), setRequestHeader: setRequestHeader(), overrideMimeType: overrideMimeType(), statusCode: statusCode(), abort: abort(), state: state(), always: always(), catch: catch()
, … }
Object { readyState: 4, status: 200, statusText: "load" }
parsererror
SyntaxError: unexpected token: ':'[Learn More]
Response headers (159 B)	
access-control-allow-credentials: false
cf-ray: 4a998491284d9f72-IAD
content-encoding: br
content-type: application/json;charset=utf-8
date: Fri, 15 Feb 2019 17:33:08 GMT
expect-ct: max-age=604800, report-uri="ht….com/cdn-cgi/beacon/expect-ct"
server: cloudflare
strict-transport-security: max-age=31536000; includeSubDomains; preload
vary: Accept-Encoding
vary: Accept-Encoding
X-Firefox-Spdy: h2
x-hubspot-ratelimit-daily: 160000
x-hubspot-ratelimit-daily-remaining: 116395
x-hubspot-ratelimit-secondly: 60
x-hubspot-ratelimit-secondly-remaining: 59
x-trace: 2B1750502C32EBB7DD88D989AD3F05B2F1A5BD8B32000000000000000000
Request headers (0.977 KB)
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.5
Connection: keep-alive
Cookie: __cfduid=d5833bca87f634ab03bd9…8d5ec6375edd376798-1550246991
Host: api.hubapi.com
Referer: http://127.0.0.1:8000/
User-Agent: Mozilla/5.0 (Windows NT 10.0; …) Gecko/20100101 Firefox/66.0

Hi @Dinder , our APIs do not support client side calls aside from the Forms V3 API, and the GET methods for HubDB: Accounts Dashboard | HubSpot. You’ll have to make your requests server-side