You are on page 1of 10

Module 3: Data Formats

Rey Benjamin M. Baquirin, MSCS


Data Formats
• Explore the data that APIs provide
• How it is formatted
• How HTTP makes it possible
Representing Data
• APIs work by knowing the proper input and output data formats to
and from the Server

• The most common formats found in modern APIs are: JSON


(JavaScript Object Notation) and XML (Extensible Markup Language)
Built on
Javascript, a
PL ubiquitous
to front-end
and back-end
web
applications

Values: actual
01
details of the
attribute that
04 Very simple
describes the
object
02 structure: keys
and values
03
Keys:
represent an
attribute about
the object
being
described

JSON (JavaScript Object Notation)


Old Data
Format (1996)
but still used
today

Instead of
01
keys, XML
nests nodes
04 Much like
02 HTML, uses
tags
03
Tags are start
and end,
containing
details in
between

XML (Extensible Markup Language)


XML always starts with the root node with an arbitrary
number of child nodes inside
JSON and XML with HTTP
• All data formats are
determined in the
HTTP Headers through
the Content-type
header.

• This header lets the


server/client know
how the request body
is formatted
JSON and XML with HTTP
• The content type is important
as the client/server first checks
if it can understand the specific
format otherwise it responds
with an error
• In some cases, clients are only
limited to one specific format
• As such, the Accept header
comes into play. This header
tells the server what data
format the client can read
Canvas
Quiz
Exams Next
Next Week Meeting

Canvas
Final Project: Module 3 -
API Submission
Walkthrough

You might also like