0% found this document useful (0 votes)
14 views2 pages

API Testing Overview and Homework

The document outlines the structure of API projects, referred to as 'collections', which contain documents with a BASEURL and endpoints. Each endpoint requires a request type corresponding to CRUD methods: get, post, put, patch, and delete, with specific functions for each type. It also explains response codes for API interactions and provides a homework assignment to create various requests using a specified URL.

Uploaded by

duaa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

API Testing Overview and Homework

The document outlines the structure of API projects, referred to as 'collections', which contain documents with a BASEURL and endpoints. Each endpoint requires a request type corresponding to CRUD methods: get, post, put, patch, and delete, with specific functions for each type. It also explains response codes for API interactions and provides a homework assignment to create various requests using a specified URL.

Uploaded by

duaa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

* each project we call it as "collection"

*each project has a document

* each document has inside it a BASEURL ( sometimes you can see that the document
dosen't have a baseURL so the URL of the document is the baseURL)

[Link]

*each BASEURL is followed by an endpoint ( sometimes you can see that the endpoint
has two different names (resource,service)

[Link]

* each endpoint suppose to have request

*each request has a type and this type is going to be one of the following

get,post,put,patch, delete --- are the same as the Crud Methods below

get : retireve the data for me ( get me the data) for example if you search about
someone on Facebook

post : i need to add a certian data ( for example sign up on facebook )

put : it will update one record for you ( for example update your name on
facebook ) ( it will insert and then update incase the record was not there)
patch : it will update one record for you ( for example update your name on
facebook ) ( it will give me an error incase there is no record to update )

delete : it will delete some data for me ( for example delete one friend from your
facebook friendlist )

* API is stands for

{{

application program interface

the response code shall be one of the following


100-199 informative not important
200-299 it means everything is ok the request is passed

300-399 - it means the website is redirecting you to another page

400-499 it means that we have a problem from ourside (client side error)
500-599 it means that the problem from the server itself ( server side error)

seven Json viwer

crud methods ==== API methods

create ===== post


read ==-=== get
update ----- patch / put
delete ===== delete

HomeWork

[Link]

you need to create 5 request ( get , post, put ,patch,delete)

Common questions

Powered by AI

The use of 'resource' and 'service' as endpoint names highlights the dual focus in API design—resources typically refer to specific data entities or collections, such as user profiles or comments, whereas services might denote a broader set of operations or processes applied to resources . Recognizing these terms helps developers understand whether they are interacting with discrete data entities or executing a series of operational tasks, which influences how they structure and approach API calls.

A missing 'BaseURL' can lead to endpoint interaction failures since the endpoint would lack a reference anchor in the URL structure, causing misdirected or failed API requests . To mitigate these issues, developers can define default BaseURLs, employ configuration files that set environment-specific BaseURLs, and ensure thorough documentation to preemptively address the absence of explicitly defined BaseURLs.

'PATCH' is more beneficial when you need to update a part of a resource without affecting the entire data set, thus reducing unnecessary data transfers and maintaining existing information that does not require changes . This method is particularly advantageous in large-scale applications where only small pieces of data require frequent updates, minimizing network traffic and processing load.

Understanding response code ranges enables testers to quickly assess and categorize API successes and failures—success codes (200-299) confirm expected behavior, whereas other ranges point to specific issues: informational (100-199), redirections (300-399), client errors (400-499), and server errors (500-599). This categorization facilitates targeted debugging efforts by isolating root causes of errors, such as malformed requests or server misconfigurations, enhancing testing efficiency.

CRUD forms the backbone of many API frameworks, particularly RESTful services, by defining essential operations for resource management: creating, reading, updating, and deleting data . This model influences API design by promoting endpoint uniformity—each operation typically maps to a standard HTTP method (POST, GET, PUT, DELETE), facilitating predictable and scalable service implementation that conforms to REST principles.

'PUT' is used to update a record, and if the record does not exist, it will create one and then update it. Conversely, 'PATCH' is solely for updating a record and will generate an error if the record does not already exist . This distinction influences data handling as 'PUT' can lead to data redundancy if improperly managed, while 'PATCH' enforces pre-existence of data, promoting safer update operations.

HTTP response codes categorize request outcomes to assist in understanding results. Codes 200-299 confirm successful requests, while 300-399 indicate redirections. Codes 400-499 signal client-side errors, often due to issues like bad requests or unauthorized access, prompting users to check their request formats and permissions. Codes 500-599 reveal server-side issues, suggesting problems within the API service infrastructure . By identifying the category of these codes, developers can pinpoint whether issues arise from their requests or from the server, streamlining the diagnosis process.

The 'BaseURL' serves as the fundamental anchor of the API request, specifying the root address of the API. It is typically combined with an 'Endpoint' to create a full URL, directing the request to a specific resource or service, such as https://jsonplaceholder.typicode.com/comments. If a document lacks a 'BaseURL', the URL of the document itself acts as the default BaseURL . Without a clear BaseURL, requests may lead to incorrect or unreachable addresses, causing errors and preventing access to the desired resources.

CRUD, an acronym for Create, Read, Update, and Delete, represents fundamental operations in data handling. These operations correlate with HTTP methods, where 'POST' aligns with 'Create', 'GET' aligns with 'Read', 'PUT' (and sometimes 'PATCH') aligns with 'Update', and 'DELETE' aligns with 'Delete' . This correspondence allows for a standardized approach to performing database operations through HTTP requests.

Improper handling of HTTP response codes in the 400-499 range can expose APIs to security vulnerabilities such as revealing sensitive backend information through overly detailed error messages. These client-side errors, if mismanaged, can also enable attack vectors like unauthorized access to resources . Ensuring that response messages are carefully crafted to provide minimal diagnostic information to users while logging full error details server-side is crucial to maintaining API security and mitigating potential threats.

You might also like