API Flashcards
What are API’s?
API, or Application Programming Interface, acts like a language that lets different software systems talk to each other. It’s like a messenger sends requests for information from one system to another, when it gets a response, it translates and delivers it. APIs make sure different software can work together smoothly.
What is a Web Service? API vs Web Service?
Web services are APIs accessible online. They need an internet connection and are accessed through a web service URL. It’s important to know while all web services are APIs, not all APIs are web services.
What type of Web Services do you know? What are the differences?
SOAP, which is more secure but slower, follows W3C consortium guidelines, and uses XML; RESTful, which is faster, lightweight, allows flexible development without strict guidelines, and uses JSON, XML, or TEXT for data exchange.
Which Protocol is used by RESTful Web Services?
RESTful web services use HTTP/HTTPS protocols as a medium of communication between client and server.
Most Commonly Used HTTP Methods Supported By REST?
POST creates new data, GET retrieves information, PUT replaces the target resource, PATCH updates selected values, and DELETE removes the specified resource.
Can a GET request be used instead of PUT to create a resource?
To create a resource, use the POST or PUT method, with PUT also serving for updates, while GET is only for requesting data from a specified resource.
What is the difference between PUT and POST requests?
With a POST request, goal is to create a new object on the server, with a PUT` request, the goal is replace an existing object with another (Update).
Which HTTP Status codes you know?
HTTP status codes provide information about requests: 1xx for information, 2xx for success (like 200 Ok), 3xx for redirection, 4xx for client errors (e.g., 400 Bad Request), and 5xx for server errors (e.g., 500 Internal Server Error).
What is API Testing?
Is a type of testing which determines if the developed APIs meet expectations about the functionality, reliability, performance, and security of the application. We test to verify that we get what is expected. We will have to verify a few areas of the response body and also status codes.
What are the advantages of API Testing?
API testing, focusing on core functionality and code-level operations, it is directed before GUI tests to catch issues early, proving time-effective and cost-saving. It’s language-independent, using XML or JSON for data exchange, offering flexibility in code language selection. This testing is crucial for accurate data exchange in web services, especially for third-party vendors like Expedia, where errors can lead to financial losses.
What is EndPoint?
An endpoint is a location where a resource can be accessed, identified by a URI like /BookStore/v1/Books or /Account/v1/User. Creating a URI is essential to successfully access to endpoint, representing one end of a communication channel when an API interacts with another system.
What tools can be used to test APIs? How do you test APIs in your project?
In our project, we utilize REST APIs, managing manual testing with Postman. We improve Postman’s features, organizing tests using global and environment variables for easy value changes. Postman’s JavaScript methods validate status codes and verify response items, with the collection runner executing multiple calls in order. For automation, we use the Rest Assured Java library. As a tester, I send API requests (GET, POST, PUT, or DELETE) and verify status codes, response bodies, and check headers. I make sure each endpoint functions as expected. For positive testing, I send valid requests, headers, parameters, and JSON bodies, verifying a 200/201 response. In negative testing, I send invalid elements, expecting a non-200/201 status code.
What is a URI?
URI, or Uniform Resource Identifier, is a string that identifies and locates resources on the internet, combining a domain or base URL with a specific path or endpoint. URI = Domain/Base URL + endpoint URL/service URL/resource
Do you have an API documentation website for your API? Any other API documentation you know?
my experience has been primarily with Swagger. It’s an open-source framework supporting developers in designing, building, documenting, and consuming RESTful Web services. there are also various API documentation templates like FlatDoc, RestDoc, and API Blueprint.
Can you tell me what is required to send a POST, GET, PUT, PATCH, and DELETE calls?
? In our web connections, when we use POST, we make sure to include a URI, headers, and a payload (data in JSON, XML, etc.). For GET, only the URI and headers are needed since no payload is required for retrieving data. When it comes to PUT (update), we need a URI, headers, and a payload to modify information. On the other hand, DELETE requires a URI and headers, and optionally a payload sent as a JQuery or PATH parameter. It’s important to note that the HTTP request method includes the request method (Get, Post, Put, Delete), request URI (complete resource URL), request header (Accept, Content-Type), and request body (data to be sent to the resource).