Ionic / API consuming

Hi guys!

First of all I would like to say that I am new to this community and I think it is great!

I would like to ask you for your advice. I have decide to create an app using Ionic.

The app would need to get the data from an API (the API is already set-up).

I would need to send GET requests and each request must contain a private API-Key in the http request-header like in the following example: x-api-key: TcKkYuizu67bsamplexeF4AGTnGWgY7E8MCiTEST

What would the best possible way to do that?

First of all, you must read the Angular HttpClient documentation.

Read the headers section carefully to learn how to add your x-api-key header.

With this resources you must be able to create your own ApiClient provider.

2 Likes

Thanks, @ramon :slight_smile:
I was thinking about AngularJS also, but I just wanted to make sure if this would be the best option to do it. This confirms it. Thanks a lot!
And I guess json would be the best format for the data?

If your project is an ionic v3 project, you do not have to use AngularJS.

I usually use JSON, but everyone has their own preferences.

1 Like

Ok, thanks! I will decide once Iā€™m ready with the API consuming :slight_smile: