cloud module 5
cloud module 5
Dr. C.R.Dhivyaa
Assistant Professor
School of Computer Science and Engineering
Vellore Institute of Technology, Vellore
Cloud application development
using third party APIs
What is the 3rd party API?
• A third-party API, or Application Programming Interface,
is a tool that allows you to access the data or functionality of a
third party on your application or site.
• Third-party APIs are often provided by companies like
Facebook, Twitter, or Google.
• Third-party APIs can be used for a variety of applications,
including: Social login, Online payment, Customer data
management, and Webhook implementation
What is the 3rd party API?
• When you come to a restaurant and want to order, you need a
waiter who will deliver your order to the kitchen and bring it to
your table.
• In this case, API performs as a waiter.
• It sends the request from your mobile app to a third-party API
system and delivers the result back to your app.
• In a nutshell, API describes how one computer program interacts
with another.
• Classes, procedures, functions, structures, and constants are all part
of it.
What is the 3rd party API?
What is the 3rd party API?
What is the 3rd party API?
• A third-party API is located on a server that belongs to a third-party service.
• Developers can access its features by linking to a JavaScript library or by making an
HTTP request to a specified URL pattern.
• When the connection is made, the user’s request will be sent from the app to a server
through the API and back. – it is a two-way path.
• A 3rd party API consists of the following components:
❑ Client, or in other words system that sends the request to the server
❑ The server might be the computer or database that responds to the request
Different types of APIs
• There are more types of APIs, based on how they function.
❖ Public or Free APIs
❖ Partner APIs
❖ Internal APIs
o Public or Free APIs
• A public API or open API is free to access by any outside business or developer.
• Public APIs usually have an easier authentication and authorization process.
• The most common open APIs are those provided by Google to access its many
products like AdSense, Telegram, WordPress, Google Maps, etc
Different types of APIs
o Partner APIs
• These APIs facilitate business-to-business processes and are only available to
authorized subscribers.
• For example, if your app wants to connect to an external Customer relationship
management (CRM) provided by a vendor, then an API will be provided by the
vendor to connect internal data systems with external parties.
• Partner APIs usually have a license agreement and have higher authentication,
authorization, and security mechanisms in place.
• Similar is the case with payment gateway APIs.
Different types of APIs
o Internal APIs
• These are private APIs that are intended for use only within
the business enterprise.
• For example, data sharing between HR and payroll systems.
Third-party API examples
❑ Google Maps API is a must for any navigation or geolocation mobile app since it shows
maps and driving directions so your app users don’t get lost.
❑ Facebook API is the social network API integration we use for our projects most often since
it allows authorizing new app users via their existing Facebook profile; thus, users avoid
filling in long registry forms.
❑ Skyscanner API might be helpful if you want to create a travel mobile app and provide
users with flight searches, ticket prices, and live quotes from ticketing agencies.
❑ Booking API will add such information to your mobile app as accommodation queries,
facilities, prices, and other info from hotels around the world.
Third-party API examples
❑ Spoonacular API with recipes, food, and nutrition is a must for diet and
fitness apps since it includes over 365,000 recipes and 86,000 food products.
Also, your app users can calculate the number of calories in each meal, convert
ingredients, find recipes to meet special diets, and so on.
❑ Movie Database API will work great if you consider developing an on-
demand video streaming platform like Netflix. Such an API provides access to
movie titles, IMDB rating, runtime, release date, awards, plot, and lots of other
data for each title.
❑ Uber API will allow your app users to hail an Uber taxi via your app, pay for a
drive in-app, and leave reviews.
How to do API integration to your mobile
app
How to do API integration to your mobile app
❑ Step 1 - Hire an API integration developer
• If you are not a tech person, to integrate an API into your app you will
need to hire a mobile app developer.
• For this task, a mobile development specialist will use an SDK
(software development kit) that includes a bunch of software
development tools in one installable package.
• In this way, the developer will correctly integrate the selected API.
How to do API integration to your mobile app
https://www.geeksforgeeks.org/facebook-api-set-1/
Graph API
• Graph API is the primary way to access means read and write data on the
social media Facebook social graph.
• Graph API is basically composed of 3 components:
✓ Nodes
✓ Edges
✓ Fields
Nodes
• These are individual objects such as a User, Page, Photo, or Comment.
• We use Nodes to gather data about individual Objects.
Fields
• These represent the data or Information about an object. User Age and Date
of Birth are examples of fields that are associated with a node User.
• fields are used to specify the data that we want to include in a response.
Edges
• These represent the connections between collections of objects and single objects.
• Edges are used to publish single objects to the collection of objects or to get collections
of objects that are connected to a single object.
• Suppose we consider a Photo posted on the Facebook Profile of an Individual.
• Now the comments associated with this Photo refer to the collection of Objects that
are associated with a single Object which is a Photo in our case.
• Graph API is HTTP-based, so it works with any Language that has an HTTP, HTTP-
based library like curl, urllib, etc.
• All requests are passed to the graph.facebook.com host URL.
• Access Token here majorly serves 2 purposes:
❑ It allows the app to access a User’s Data without requiring the User’s credentials.
❑ It allows the server to identify who is using the app and to determine accordingly
what functions that user is permitted to do.
4 types of Access Tokens
User Access Token
▪ This is the most commonly used access token, needed when an app calls an API to read,
modify, or write data on a specific person’s Facebook Page.
▪ This is achieved through a login dialog where a person is required to permit the app to
obtain an access token
Client Token
▪ A client token is an identifier that can be embedded in native mobile binaries or desktop
apps.
▪ It is used to access app-level APIs.
Twitter API
https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api
• The Twitter API can be used to programmatically retrieve and analyze Twitter
data, as well as build for the conversation on Twitter.
• Over the years, the Twitter API has grown by adding additional levels of access
for developers and academic researchers to be able to scale their access to enhance
and research the public conversation.
• Recently, we released the Twitter API v2. The Twitter API v2 includes a modern
foundation, new and advanced features, and quick onboarding to Basic access.
How to get access to the Twitter API (1/3)
• HDFS is used to store and manage large data sets, and is a key component of
many Hadoop systems.
✓These are slave daemons or process which runs on each slave machine.
✓The actual data is stored on DataNodes.
✓The DataNodes perform the low-level read and write requests from the file
system’s clients.
✓ They send heartbeats to the NameNode periodically to report the overall health of
HDFS, by default, this frequency is set to 3 seconds.
Components of HDFS
Block
✓Blocks are the nothing but the smallest continuous location on your
hard drive where data is stored.
✓A Block is the minimum amount of data that it can read or write.
HDFS blocks are 128 MB by default and this is configurable.
HDFS – Data Organization
• Each file written into HDFS is split into data blocks.
• Each block is stored on one or more nodes.
HDFS – Data Organization
• Each copy of the block is called a replica.
• The third replica is placed in the same rack as the second replica.
•Mapping
•Reducing
•Combining
MapReduce Programming Model
Different Phases of MapReduce
MapReduce Programming Model
Different Phases of MapReduce
MapReduce Programming Model
Different Phases of MapReduce
MapReduce Programming Model
Different Phases of MapReduce
Mapping - The input data is processed and divided into smaller segments in the
mapper phase, where the number of mappers is equal to the number of input splits.
Then, map tasks create a <key, value> pair for every word.
Shuffling - the output of the mapper phase is passed to the reducer phase by
removing duplicate values and grouping the values.
Sorting - Sorting is performed simultaneously with shuffling. The Sorting phase
involves merging and sorting the output generated by the mapper.
Reducing - reduced to produce a single output value that summarizes the entire
dataset
MapReduce Programming Model
MapReduce Programming Model
1. Application starts a Master instance and M worker for the Map
phase and R worker for the Reduce phase
4. The results are stored on the local disk and R instance reads the
results