Help in sending Get Request in Ionic

Hello,

So i’m well aware of HttpClient as a module to send request to a REST API server. The thing is I have developed a REST API in Php and have it hosted in my bought web server. Whenever I send a get request from postman/browser, I get the desired response. However, when I try to send a get request from my ionic app. I’m faced with Http 406 error.

Can somebody try and send a request to this url: http://pdcatapi.usc-dcis.com/hcf/read_one.php?hcfId=5 ?

If you’re successful, kindly teach me how to do so as I’ve had this problem for 1 week now. And I am stuck.

Here are the screenshots of my codes:

Ionic-Angular-

PHP REST API

Desired response is {“id”:“5”,“name”:“Gullas Memorial Hospital”,“type”:null} of JSON type.

Thanks!

See if the problem persists using HTTPS instead of HTTP.

Hello,

What do you mean? Can you instruct me what to do to in using HTTPS instead of HTTP?

You probably need your REST server to be served using https instead of http.

Try your code using this url…

https://reqres.in/api/users/2

Hi Geoff,

I did get the data using my ionic app from the url endpoint you’ve provided. Will try to implement the same thing with my REST API later when I get home. Gonna keep you posted.

Thanks!

Hi Geoff,

Unfortunately, it didn’t work too on my API. It keeps on responding with 406 error. I just don’t know what causes this issue.

TODO list:

Thanks for the reminders. However, I have already dealt with my situation but it doesn’t have anything to do with Https nor SSL certificate. I’m grateful regardless!