HTTP(S) Connection

API providers use API keys as a simple authentication mechanism so they can charge for their data, whether that’s traffic information, stock market data, or weather information. Figure 4-1 shows a simple app that allows us to call a Weather Underground URL to display the current weather conditions for your area. In the app, you can either send the request via HTTP or HTTPS by clicking the appropriate button.

Image

Figure 4-1 Android client request

If you’re sending the request via HTTP or HTTPS the URL is called as follows, where 2ee858dd063ef50e is the API key:

http(s)://api.wunderground.com/api/2ee858dd063ef50e/conditions/q/MI/Troy.json ...

Get Bulletproof Android™: Practical Advice for Building Secure Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.