API Testing
API Testing
100 Continue
201 Created
202 Accepted
204 No Content
226 IM Used
302 Found
306 (Unused)
403 Forbidden
409 Conflict
410 Gone
Authentication
Authentication is the verifiying the user to access the system.
The primary purpose of authentication is to ensure that only authorized users can gain access to the
resources. -During Authentication, user provides credentials such as a username and password,
digital certificate key. or an API then compares the provided credentials with the validate this
identity. The System Stored Credential for that user to
Authorization
-Authorization is the process of determining what actions. Operation a cerified and authenticated
user is allowed to Within the System application and resource.
-The purpose. of authorization is to control and restrict action or the operation that an authenticated
user can perform based on permission and privilege.
Local variable
These are temporary variables that will only function inside the environment they were created in.
when you change the environment will stop its access, and an error will occur.
Collection Variable
These are independent of environment and are available for all the request in a collection.
Environment Variables
These are the rest used variable scope in postman. After time single environment can be active they
environment used to execute the request.
Global variables
These are independent environment and function outside the environment, we are not required to
create an environment for global variables. Through global variable, we can access data Collection,
test scripts, requests, and environments.
Data Variable
Data variables came from external CSV and JSON file o define data sets. We can use while collections
are running through Collection Runner
"name":"{{name}}",
"job": "{{job}}"
select files [only CSV and JSON file format will accept].
-- collection name. -- create folder -- View More action -- collection name -- Add folder-- folder name
End point
https:// rares. in /api/ users? Page = 2.
HTTP Methods
Get
Used to retrive data from server using given URI. No Need Body/ payload to pass input. Send the
input data through Query Parameter Path parameter.
Post
Put
Delete
Path Parameter
Path Parameter is present in variables parts of resource. They are typically used to point to Specific
resources within a collection.
Path parameter are identified by /. Only path parameter is present in bare url.
Query Parameter
Query parameter is used to sort and filter the resource. Query parameter are identified by ?. Each
Query parameter separated by &.
Headers
-> Header represents meta data associated with the API request. We sending additional details to the
server to process the request.
JSON Array:
Json array represents ordered list of value. JSON array store Multiple value. It can be string, boolean,
number or object in json array. In JSON array values must be seperated by comma. The [ (square
bracket)] represents JSON array.
API
Application programning Interface (API) is an Communication Protocol between Client and sever.
HTTP request
→ HTTP works request and response Protocol between a client and server.
→ A Client (browser) Sends an HTTP request to the server. Send HTTP request in xml or JSON format
HTTP response
→ The client Submits HTTP request to the server, and ofter internatizing the Message the Server.
Sever sends back a response. Response contains the status Information about the request.
XML
->> Entensible Markup Language
JSON:
→ JavaScript object Notation. Json is platform independent language.
JSON Object
JSONObject is an unordered collection of key and Valce pains; Keys are unique strings that cannot be
null. Values can be anything from boolean, number, String.
Json object can be represented by a string enclosed within Curly braces {} with keys and Values
Seperated by a colon, and pairs separated by а сomma.
JSON Structure:
→ JSON object {}
→JSON Array []
//Create Place
RestAssured.baseURI="https://rahulshettyacademy.com";
System.out.println(response);
//Update Place
given().log().all().queryParam("key", "qaclick123").header("Content-
Type","application/json").body("{\r\n"
+ "\"place_id\":\""+placeId+"\",\r\n"
+ "\"address\":\""+newAddress+"\",\r\n"
+ "\"key\":\"qaclick123\"\r\n"
+ "}\r\n"
+
"").when().put("maps/api/place/update/json").then().assertThat().log().all(
).statusCode(200).body("msg", equalTo("Address successfully updated"));
// Get Place