Using API
Objectives
◆ Understand the Networking Essentials
◆ Introduction to API
◆ Distinguish between SOAP and REST APIs
◆ How Do Apis Work?
◆ Distinguish between JSON and XML
2
Client and Server
• Web applications are not stand-alone
• Many of them have a “Cloud” backend
09/19/2025 3
Client-Server Communication
• Network operations cause unexpected delays
• You need to write applications recognizing the asynchronous
nature of communication
• Data is not instantaneously available
09/19/2025 4
What is API?
• API is the acronym for Application
Programming Interface.
• A type of software interface that let two
programs communicate with one another.
• An API define features that have nothing
to do with the execution of each
implementation
• APIs enable programmers to regularly
reuse difficult, repetitive operations with
only a little amount of code
5
SOAP APIs
• SOAP stands for Simple Object Access Protocol.
• This type of API is popular due to its strict structure and
independence from any specific programming language.
• Examples of SOAP APIs include the folowing:
• Salesforce SOAP API.
• Workday SOAP API.
• Sabre SOAP API.
6
Example about SOAP
• Using SOAP, the request to the API is an HTTP POST request
with an XML request body. The request body consists of an
envelope which is a type of SOAP wrapper that identifies the
requested API, and a SOAP body that holds the request
parameters. In this case, we want to fetch the user with the
name “John.”
7
REST APIs
• The acronym REST stands for Representational State
Transfer.
• A RESTful API has all the features of the REST architecture,
but it differs slightly in that it has a transport protocol and
keeps cached data available at all times rather than deleting it
when the API is not in use. Due to its unique features, a
RESTful API tends to be more flexible yet less secure.
• Examples of REST APIs include:
• Amazon Product Advertising REST API.
• Flickr REST API.
• YouTube REST API.
8
REST APIs – cont’d
9
Example about REST APIs
• REST APIs can be called with all of the HTTP verbs. To get a
resource, in this case, a user, a GET request is used. While
the SOAP request holds the user’s name in the body, a REST
API accepts GET parameters from the URI.
• GET https://restexample.com/users?name=John
• As mentioned, REST APIs typically use the data format JSON.
The user is represented in JSON like this:
10
Compare between SOAP and REST APIs
11
12
A RESTful API
• Has all the features of the REST architecture, but it differs
slightly in that it has a transport protocol
• Keeps cached data available at all times rather than deleting it
when the API is not in use
• A RESTful API tends to be more flexible yet less secure.
13
What does API gateway do?
• The diagram below shows the detail.
• Step 1 - The client sends an HTTP request
to the API gateway.
• Step 2 - The API gateway parses and
validates the attributes in the HTTP request.
• Step 3 - The API gateway performs allow-
list/deny-list checks.
• Step 4 - The API gateway talks to an
identity provider for authentication and
authorization.
• Step 5 - The rate limiting rules are applied
to the request. If it is over the limit, the
request is rejected.
14
What does API gateway do? – cont’d
• The diagram below shows the detail.
• Steps 6 and 7 - Now that the request has
passed basic checks, the API gateway finds
the relevant service to route to by path
matching.
• Step 8 - The API gateway transforms the
request into the appropriate protocol and
sends it to backend microservices.
• Steps 9-12: The API gateway can handle
errors properly, and deals with faults if the
error takes a longer time to recover (circuit
break). It can also leverage ELK (Elastic-
Logstash-Kibana) stack for logging and
monitoring. We sometimes cache data in
the API gateway.
15
WHAT DOES AN API DO?
• Through an API, two computers can talk to one another.
• To communicate with the server, which is where the data is
stored, the client uses the language that the server provides.
• Servers never provide data without a client asking for it, even
though developers have come up with numerous techniques
to get around this with webhooks.
16
WHAT DOES AN API DO? – cont’d
• An API can perform the four
types of actions listed below:
• GET: Requests data from a server.
• POST: Transmits updates from the
client to the server; consider a
POST request as creating a new
record in the server's database.
• PUT: Revises or adds to existing
information.
• DELETE: Deletes existing
information
17
Important Benefits of Using API
• Using API allows you to create a seamless stream of data
transfer between applications and devices in real time.
• Improve the quality of the user experience.
• Speed of development and budget saving.
• Complex operations become simple.
• Scaling options.
• Based on API, things such as maps and routes, all kinds of
mobile and desktop clients for social networks and other
products that people use on a daily basis are built.
18
API vs SDK: Key Differences
• 𝗔𝗣𝗜
• An API is a set of rules and
protocols that allows different
software applications and services
to communicate and share data.
• 𝗦𝗗𝗞
• An SDK is a comprehensive
package of tools, libraries, sample
code, and documentation to
simplify building apps on a specific
platform, framework, or hardware.
19
What is JSON?
• JSON is a text-based data format that follows the JavaScript
object syntax made well-known by Douglas Crockford.
• JSON can be used as a string for data transmission over a
network.
• Data structured as:
• A collection of
• name/value pairs: Ordered list of values
20
History of JSON
These significant events helped shape JSON's history:
• Douglas Crockford defined the JSON format at the start of the
new millennium.
• The of official website debuted in 2002.
• In December 2005, Yahoo! started offering online services
based on JSON.
• JSON was acknowledged as a global standard by ECMA in
2013.
• The most recent JSON format standard was published in 2017.
21
Features of JSON
• Easy to use: Commonly used use cases can be streamlined
thanks to the high-level façade given by JSON API.
• Performance: JSON is suitable for large object graphs or systems
because it is relatively speedy and needs very little memory.
• Free tool: The JSON library is a free, open-source resource.
• It is not essential to construct mapping because the Jackson API
already has default mapping for many objects that can be
serialized.
• Clean JSON: Generates results that are easy to read, compatible,
and clean JSON.
• Dependency: The JSON library can be used to process data
without the use of any other libraries.
22
What is XML?
• XML is the acronym for Extensible
Markup Language.
• It provide data formats that are used to
store data for database records,
transactions, and many other types of
data.
23
History of XML
These significant events in the development of XML are listed
below:
• SGML was used to create XML.
• XML version 1.0 was released in February 1998.
• XML Media Types: January 2001 IETF Proposed Standard.
• Explicit Markup Language (XML).
• Charles Goldfarb, Ed Mosher, and Ray Lorie founded GML in
1970.
• In 1996, Sun Microsystems started developing XML.
24
Features of XML
• XML tags are not predened. Your customized tags must be
specified.
• XML was designed to transmit data, not to display it.
• XML markup code is simple for humans to grasp.
• In contrast, the structured format is easy to read and write
from programs.
• XML is an extensible markup language, just like HTML.
25
Difference between JSON and XML
• The screenshot below captured the prime difference between
JSON vs XML:
26
JSON XML
Stands for JSON means JavaScript Object Notation. XML means Extensible Markup Language.
Douglas Crockford and Chip Morningstar The XML Working Group released XML in
History
released JSON in 2001. 1998.
JSON uses a maplike structure with key-XML stores data in a tree structure with
Format
value pairs. namespaces for different data categories.
The syntax of XML substitutes some
The syntax of JSON is more compact and
Syntax characters for entity references, making it
easier to read and write.
more verbose.
You can parse JSON with a standard
Parsing You need to parse XML with an XML parser.
JavaScript function.
Schema
JSON is simple and more flexible. XML is complex and less flexible.
documentation
XML supports all JSON data types and
JSON supports numbers, objects, strings,
Data types additional types like Boolean, dates, images,
and Boolean arrays.
and namespaces.
JSON has smaller file sizes and faster XML tag structure is more complex to write
Ease of use
data transmission. and read and results in bulky files.
You should turn off DTD when working with
Security JSON is safer than XML.
XML to mitigate potential security risks.
27
Summary
◆ Concepts were introduced:
◆ Understand the Networking Essentials
◆ Introduction to API
◆ Distinguish between SOAP and REST APIs
◆ How Do Apis Work?
◆ Distinguish between JSON and XML
28