API Flashcards
What is API?
Application Programming Interface - a messenger that takes requests from one application(client side) (DB) and translate it to another application(server side)(Database)
What is Web Services?
- API going through internet
- Can be ran via internet or locally
What WebServices do you use in your project?
- I use Restful which is the Representational State of Transfer and it communicates with XML
and JSON but my current project uses JSON
What is JSON?
- It is JavaScript Object Notation
- Basically a lightweight version of XML
- In Key: Value format • Key is always in double quotes and value if string its double quotes and if numbers no quotes
- It is purely based on HTTP protocol - so it hits the link on the browser and sees the results
How and where are you sending request?
Since I am using Rest, it has endpoints. My developers create public URLs and requests are sent to that URL
Do you use any non-web services API?
- I use Selenium API for the browser, JDBC for the database, and RestAssured for API
How do you test API in your project?
In my current project, we are testing not only our company’s API but other external APIs.
For example, we use LinkedIn API to easily transfer the authorized end user’s info to our
database. As a tester, we send an API request and verify the status code, response body
and check the endpoints of the API URL are working as expected
For example in my project, I also do Positive/Negative testing of API
- Positive - I am sending valid requests, headers, parameters, and JSON body and verify that response is 200/201
- Negative - I am sending invalid requests, headers, parameters, and body,
expecting the status to not be 200
Do you have API documentation website for your API?
Yes, we use swagger for our API documentation and this is where the description and guidelines of API endpoints are
Can All API endpoints use all of the HTTP protocols?
It depends, My API developer decides if that URL works with GET, POST, PUT, or DELETE
requests
How do you manually test your API?
I use Postman - it is a REST API client tool that tests the REST API URL
What are the types of Request in Rest API?
There are Get, Post, Put, and Delete requests
- Get reads data
- Post creates data
- Put updates data
- Delete deletes data
What are headers in REST API?
I am using Accept. (Content Type.JSON) type - checks what I am receiving should be in
JSON or XML format
and ContentType.(Contenttype.Json) - checks what I am sending should be in JSON format
What is RestAssured Library?
A non-web service API that’s BDD format and helps integrate java code using deserialization and serialization to extract data from the JSON and transform it into a java object in order to store, verify and validate the data to the expected one.
What is JDBC?
JDBC (Java Database Connectivity) is the Java API that manages connecting to a database, issuing queries and commands, and handling result sets obtained from the database
What is JsonPath?
Another way to validate the response body
-JsonPath j=response.jsonpath;