Ionic Rest API error - get api

#1

Hi All - I am new to Ionic

I am stuggling to make it work - I am trying to access REST API from CiviCRM -

getContact(apiUrl : string) {
let par = {entity:‘Contact’,action:‘get’,api_key:‘abcxxxxx’,key:‘abcxxx’, id:‘1’ };
//json:’{“sequential”:1,“id”:1}’
return new Promise(resolve => {
this.http.get(apiUrl,{params:par}).subscribe(data => {
resolve(data);
}, err => {
console.log(err);
});
});
};

The above link works alright in the browser but when I use the same against Ionic i am getting the below error message

Failed to load https://www.abcxxx.co.uk/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=get&api_key=abcxxx&key=abcxxx&id=1: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:8100’ is therefore not allowed access.
rest-service.ts:36 HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: “Unknown Error”, url: null, ok: false, …}error: ProgressEvent {isTrusted: true, lengthComputable: false, loaded: 0, total: 0, type: “error”, …}headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, headers: Map(0)}message: "Http failure response for (unknown url): 0 Unknown Error"name: "HttpErrorResponse"ok: falsestatus: 0statusText: "Unknown Error"url: null__proto__: HttpResponseBase
polyfills.js:3 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://www.abcxxx.co.uk/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=get&api_key=abcxxx&key=abcxxx&id=1 with MIME type text/xml. See https://www.chromestatus.com/feature/5629709824032768 for more details.
s @ polyfills.js:3
t.scheduleTask @ polyfills.js:3
onScheduleTask @ polyfills.js:3
t.scheduleTask @ polyfills.js:3
r.scheduleTask @ polyfills.js:3
r.scheduleMacroTask @ polyfills.js:3
(anonymous) @ polyfills.js:3
o.(anonymous function) @ polyfills.js:2
(anonymous) @ http.js:2364
Observable._trySubscribe @ Observable.js:172
Observable.subscribe @ Observable.js:160
subscribeToResult @ subscribeToResult.js:23
MergeMapSubscriber._innerSub @ mergeMap.js:132
MergeMapSubscriber._tryNext @ mergeMap.js:129
MergeMapSubscriber._next @ mergeMap.js:112
Subscriber.next @ Subscriber.js:93
ScalarObservable._subscribe @ ScalarObservable.js:49
Observable.trySubscribe @ Observable.js:172
Observable.subscribe @ Observable.js:160
MergeMapOperator.call @ mergeMap.js:87
Observable.subscribe @ Observable.js:157
FilterOperator.call @ filter.js:60
Observable.subscribe @ Observable.js:157
MapOperator.call @ map.js:56
Observable.subscribe @ Observable.js:157
(anonymous) @ rest-service.ts:33
t @ polyfills.js:3
webpackJsonp.102.RestServiceProvider.getContact @ rest-service.ts:32
webpackJsonp.205.ContactPage.getContact @ contact.ts:30
ContactPage @ contact.ts:26
createClass @ core.js:12491
createDirectiveInstance @ core.js:12326
createViewNodes @ core.js:13784
createRootView @ core.js:13673
callWithDebugContext @ core.js:15098
debugCreateRootView @ core.js:14381
ComponentFactory
.create @ core.js:11278
ComponentFactoryBoundToModule.create @ core.js:4030
NavControllerBase._viewInit @ nav-controller-base.js:441
(anonymous) @ nav-controller-base.js:254
t.invoke @ polyfills.js:3
onInvoke @ core.js:4760
t.invoke @ polyfills.js:3
r.run @ polyfills.js:3
(anonymous) @ polyfills.js:3
t.invokeTask @ polyfills.js:3
onInvokeTask @ core.js:4751
t.invokeTask @ polyfills.js:3
r.runTask @ polyfills.js:3
o @ polyfills.js:3
e.invokeTask @ polyfills.js:3
p @ polyfills.js:2
v @ polyfills.js:2

Any help will be good -
Thanks in advance

#2

Wondering if you found a solution. because all applications served on the browser are doomed when everyone collectively updates their browsers to the latest version of chrome, opera, etc