API Flashcards

1
Q

What is an API?

A

API (Application Programming Interface) is a software intermediary that enables two applications to communicate with each other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are main differences between API and Web Service?

A
  • All Web services are APIs but not all APIs are Web services.
  • Web services might not contain all the specifications and cannot perform all the tasks that APIs would perform.
  • A Web service uses only three styles of use: SOAP, REST and XML-RPC for communication whereas API may be exposed to in multiple ways.
  • A Web service always needs a network to operate while APIs don’t need a network for operation.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are some architectural styles for creating a Web API?

A
  • HTTP for client-server communication
  • XML/JSON as formatting language
  • Simple URI as the address for the services
  • Stateless communication
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Who can use a Web API?

A

Web API can be consumed by any clients which support HTTP verbs such as GET, PUT, DELETE, POST. Since Web API services do not require configuration, they can be easily used by any client.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is API Testing?

A

is a kind of software testing which determines if the developed APIs meet expectations regarding the functionality, reliability, performance, and security of the application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are principles of an API test design?

A
  • Setup: Create objects, start services, initialize data, etc
  • Execution: Steps to apply API or the scenario, including logging
  • Verification: Oracles to evaluate the result of the execution
  • Reporting: Pass, failed or blocked
  • Clean up: Pre-test state
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is REST?

A

REST (Representational State Transfer) is an architectural style for developing web services which exploit the ubiquity of HTTP protocol and uses HTTP method to define actions. It revolves around resource where every component being a resource that can be accessed through a shared interface using standard HTTP methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a “Resource” in REST?

A

REST architecture treats any content as a resource, which can be either text files, HTML pages, images, videos or dynamic business information.
REST Server gives access to resources and modifies them, where each resource is identified by URIs/ global IDs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are some key characteristics of REST?

A
  • REST is stateless, therefore the SERVER has no status (or session data)
    With a well-applied REST API, the server could be restarted between two calls, since all data is transferred to the server
  • Web service uses POST method primarily to perform operations, while REST uses GET for accessing resources.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the core components of an HTTP request?

A
  • An action showing HTTP methods like GET, PUT, POST, DELETE.
  • Uniform Resource Identifier (URI), which is the identifier for the resource on the server.
  • HTTP Version, which indicates HTTP version, for example-HTTP v1.1.
  • Request Header, which carries metadata (as key-value pairs) for the HTTP Request message. Metadata could be a client (or browser) type, format supported by the client, format of a message body format, cache settings, and so on.
  • Request Body, which indicates the message content or resource representation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Is there any difference between PUT and POST operations?

A

PUT operation is idempotent, so you can cache the response while the responses to POST operation are not cacheable, and if you retry the request N times, you will end up having N resources with N different URIs created on server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is URI? What is the main purpose of REST-based web services ?

A

URI stands for Uniform Resource Identifier. It is a string of characters designed for unambiguous identification of resources and extensibility via the URI scheme.

The purpose of a URI is to locate a resource(s) on the server hosting of the web service.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly