API Flashcards
(25 cards)
What is REST?
Representational State Transfer
What is a REST API?
An API is an application programming interface, which is a software-to-software interface that allows otherwise separate applications to interact and share data. In a REST API, all data is treated as resources, each one represented by a unique uniform resource identifier (URI).
What do you mean by RESTful web services?
REST API is also known as RESTful web services that follow the REST architecture.
What are cache-control headers?
Cache-control headers are used to control catching and to attain caching ability. The most commonly used cache-control headers are public, private, and No-Store.
What are the features of RESTful web services?
Client-server decoupling
Communication support
Lightweight
Uniform interface
Stateless
Layered system
Cacheable
Code on demand
What is the definition of messaging in terms of RESTful web services?
In REST API web services, when a REST client wants to send a message to the server, it can be sent in an HTTP request form, and the same applies to the server. This kind of communication is called messaging in REST.
Explain ‘Addressing’ in RESTful web services.
The process of locating various types of resources with the help of a URL on the REST server is known as ‘addressing’ in RESTful web services. Usually, single or multiple resources are addressed by resources.
Why are REST services easily scalable?
REST services are scalable due to the statelessness that they do not store data on the server even though they are requested and do not require much communication.
What is a ‘Resource’?
Resource’ is defined as an object of a type that includes image, HTML file, text data, and any type of dynamic data.
What does the HEAD method in REST APIs do?
The HEAD method is used to return the HTTP Header in read-only form and not the Body.
Different types of API architectures
The other two API architectures used:
1. SOAP (Simple Object Access Protocol)
2. RPC (Remote Procedure Call)
What are “Options” in REST APIs?
It is an HTTP method used to fetch the supported HTTP options or operations that help clients to choose the options in REST APIs. Cross-Origin Resource Sharing (CORS) uses the REST option method.
How do you keep REST APIs secure?
REST APIs can be kept secure with the help of safety measures such as Authentication and authorization, API Server Validation, TSl/SSL Encryption, Rate-limiting for DDoS attacks, and sensitive information such as username, password, or authentication token should not be visible in URIs
Advantages of REST
HTTP makes the implementation of REST easy.
REST fits in the existing infrastructure of the web, thus the web application can easily implement the REST. XML and JSON web technologies make REST easy to learn.
The client and server communication is stateless, thus the integration is easy to build and scalable, and manageable with respect to time.
The REST architecture can adapt to a huge variety of cases due to its flexibility.
The lightweight architecture of REST makes it easy to build the applications faster as compared to other types of APIs.
REST can be tested easily in the browser with the help of API testing tools.
Disadvantages of RESTful web services?
RESTful web services are stateless and do not maintain session simulation responsibility as the client side does not provide a particular session id for it.
REST is not able to impose the security restriction inherently. However, it inherits them with the help of implementing protocols. Thus, the integration of SSL/TLS authentication needs to be done very carefully for better security measures of the REST APIs.
What is a URI?
URI stands for ‘Uniform Resource Identifier.
What is a resource?
In REST, A resource is an object with a label and accessible on the server. Resources consist of associated data, a list of methods, and a relationship with other resources on the server.
The main parts of an HTTP response
HTTP version
Status line
HTTP Response Header
HTTP Response body.
Which HTTP request methods are supported by REST?
REST supports various types of HTTP request methods such as GET, POST, PUT, DELETE, HEAD, OPTIONS, ETC.
Differentiate POST and PUT methods.
POST Method
POST can create a resource on the server.
POST is not idempotent.
POST responses are cacheable.
PUT Method
PUT is used to replace a resource at a specific URI with another resource.
PUT is idempotent that it will only result in one resource even after calling it multiple times.
PUT responses are not.
Which protocol does REST APIs use?
HTTP
In REST APIs, which markup languages are used to represent the resources?
The resources in REST APIs are represented with the help of XML (extensible markup language) and JSON (JavaScript Object Notation).
What is the maximum payload size that can be sent in POST methods?
Theoretically, there is no such maximum limit for payload size that can be sent in POST methods. However, payloads with larger sizes can consume larger bandwidth. Thus the server could take more time to proceed with the request.
What are payloads in RESTful web services?
Payloads are the request data passed through the POST or GET method and found in the message’s body of an HTTP request in RESTful web services.