APIs and client server - paper 2 Flashcards
what are APIs
- a set of protocols that governs how two applications should interact with one another.
- An API sets out the format of requests and responses between a client and a server and enables one application
to make use of the services of another.
limits of HTTP communication
- client has to request data from the server
- if too much time passes between between establishing a socket connection between client and web server, the server drops the connection to conserve its resources, and returns an error message
web CRUD applications
NAME → HTTP request method → SQL command
Create → POST → INSERT
Retrieve → GET → SELECT
Update → PUT → UPDATE
Delete → DELETE → DELETE
what is REST
Representational State Transfer is a style of systems design that prescribes the use of HTTP request methods to interact with
online databases via a web server.
examples of APIs
JSON - similar to python dictionary
XML - similar format to html files
advantages of JSON
- more compact so requires less storage, so quicker to transmit and process
- easier to read, write, and maintain
- data clearly defined as objects
disadvantages of JSON
- only works with a limited range of data types
advantages of XML
- any data type allowed, so more flexible
disadvantages of XML
expensive use of tags makes it hard to follow
describe what thin- client computing is
- processing is carried out on a server
how does the client - server model work
- a client will send a request message to a server
- which should respond with the data requested or a suitable message otherwise.
example of a client - server model
- commonly seen when a client browser sends a
HTTP request to a web server for web page data or a web resource. - The page data is sent back from the
HTTP server by way of response - the browser renders the web page on the client’s computer
examples of server types
File server
Email server
FTP server
Proxy server
DHCP server
Print server
Database server
example of an API
WebSocket is a modern application layer
protocol that facilitates a persistent bi-directional communication channel between the client and the
server over a single line. This is known as full-duplex communication.
Persistent connection until the communication is terminated;
Reduced header information, increasing data transfer speed; and reducing load on server
Connecting a database to a browser with HTTP request methods
- A browser makes a client server request from a web server to load a standard web page and all of its
resources. - The web page HTML file contains some JavaScript which is executed on the client-side.
- The browser JavaScript calls the RESTful API which enables communication with the server-side
database using HTTP requests. - The database server responds to the client’s HTTP requests with the data in JSON or XML format.
- The browser renders the JSON or XML data in its own user interface.
advantages of thin client
- Easy to set up, maintain and add
terminals to a network with little installation required locally - Software and updates can be installed
on the server and automatically distributed to each client terminal - More secure since data is all kept centrally in one place
disadvantages of thin client
- Reliant on the server, so if the server
goes down, the terminals lose functionality - Requires a very powerful, and reliable
server which is expensive - Server demand and bandwidth increased
- Maintaining network connections for
portable devices consumes more battery power than local data processing
advantages of thick client
- Robust and reliable, providing greater
up-time - Can operate without a continuous
connection to the server - Generally better for running more
powerful software applications
disadvantages of thick client
- More expensive, higher specification
client computers required - Installation of software required on
each terminal separately and network administration time is increased - Integrity issues with distributed data
how does thin client computing work
- Client terminals load operating system from server at start up;
- Applications installed on server and accessed remotely by terminals;
- Client (dumb) terminals act as interfaces only;
- All processing is done by the server