APIs and JSON
The course is part of this learning path
In this course, we're going to build a currency converter app in order to teach you about JSON and APIs. We're going to get some data from the internet, process them, and then display them to the user.
This course is designed for anyone who wants to:
- Learn about iOS development and coding
- Move into a career as an iOS developer
- Master Swift skills
To get the most out of this course, you should have some basic knowledge of iOS.
Hi, within this section, we're going to build our first app interacting with Internet data. So, we're going to be downloading data from the Internet and we're going to parse. We're going to process that data so that we can show this data to the user in a format that we want. And in this section, we're not going to be working with cloud servers. Like we're not going to be creating users. We're not going to write into any database, we're not going to upload any pictures. We're going to learn that later only in the following section when we deal with the Firebase. In here, we're going to get data from the Internet through something called API. An API stands for Application Programming Interface. So, let me show you how it's spelt. So, this is API, and if you search Google for API, as you can see, it stands for Application Programming Interface and we're going to see what it is, don't worry. Now, we can use this application programming interfaces in order to provide data to mobile applications, to web applications, to softwares from our server, from our platform. For example, Google has some APIs, Facebook has some APIs, and Twitter has some APIs. With using these APIs, we can reach the data of Facebook, Twitter, Google and other platforms, other websites or other servers so that we can use their data safely in our apps. That's what we're going to do within this section. We're going to get data from application programming interface, and we're going to process that data so that we can use it in a way that we want. For example, if you search for 'facebook api', you will see this website, this is developers.facebook.com and you can actually use those APIs in order to reach data, user data in Facebook. For example, you can ask users to sign in with their Facebook account so that you can reach their followers, you can reach their friends, and do something with it. And you can get their statistics and you can do that in Twitter as well.
So, if you search for 'twitter api' as you can see, this has some documentation regarding the Twitter's APIs as well. So, again you can use this API of Twitter in order to get the user data from Twitter servers. So, as you can see, some platforms, some servers, some applications use APIs in order to provide data to other softwares like mobile applications, web applications. And not only these big projects, not only these big companies do that, you can actually use whatever API you want. For example, you can search for a weather API. So, you can get the weather forecasts out of various APIs. As you can see, we have a lot of examples in here. And in this section, we're going to build a currency converter. So, if you search for currency converter API, you will see a lot of options as well. And in this section, I'm going to be using one of these APIs actually in real time so that you can see how we can get data out of that website, and how we can integrate that data in our application. So, we're going to be converting currencies and we're going to display some kind of different currencies to the users.
So, we're going to get the Euro currencies and we're going to convert that currency into dollars, Japanese yen, like Swiss franc. And I'm going to use this 'fixer.io'. So, this is one of the APIs, and I randomly chose this. I tested it and it works fine so, we're going to be using that. In your own time, you can try to work with another API as well. However, at the timing, since you don't know how to work with APIs, I really suggest you stick with me and follow this fixer.io example. So, in fixer.io, we're going to get data like this. As you can see, it provides 170 world currencies, so this displays a huge data to us. This displays a lot of currencies in their own data. And if you click on this 'Pricing', you will see we have a free option and that's one of the reasons why we are using this API. So, we're going to work with free version of course, but as you can see there are a lot of options in here, like a Basic one and Professional one. And, of course, we have some limitations on the Free version, like we get only hourly updates, we get limited support, historical data and one 1,000 API calls per month.
So, in here in the Basic version, as you can see you get 10,000 API calls, in the Professional version you get 100,000 API calls, and in the Professional Plus, you get like 500,000 API calls. So, if you're going to be working with more, of course, you can just contact the fixer.io and you can get a pricing out of the year sales representatives. sales representatives. And if you have a big website or if you have a big application, you can use this Professional Plus, for example, in order to display the real time data, as you can see it provides 60-second Updates. So, this is actually real time. So, you get the real time currency numbers around the world so that you can display them to your user. And coding will not differ between these versions. We will just write the same code, whatever we choose in here, so that's why we're going to go with the Basic one. We're going to go with the Free one, in fact. And after that, we're going to process this data and show this data to the user. That's why within the next lecture, we're going to cover something called JSON format.
Atil is an instructor at Bogazici University, where he graduated back in 2010. He is also co-founder of Academy Club, which provides training, and Pera Games, which operates in the mobile gaming industry.