I am using the Zendesk API and am able to make post requests (even though the response tells me there is an error) but I cannot make GET requests using my Angular 4 app and HttpClient.
searchZendesk( query : string ) {
console.log(query)
this.search( query ).subscribe(
(data) => console.log(data),
(err) => console.log(err.error),
() => console.log("complete")
)
}
search( query : string ) {
let headers = this.setOptions()
let url = `${ this.baseUrl }/search.json?query=${ query }`
return this.http.get(`${ this.baseUrl }/search.json?query=${ query }`, { headers: headers })
}
setOptions() {
let key = this.setKey()
let headers = new HttpHeaders({
'Authorization': key,
})
return headers
}
After calling searchZendesk()
I receive the following error:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.