Search the courses, subjects, tracks, games and features, or jump straight to a page.
Learn it your way
A short class with Sarah and her students. The other ways are under More.
Sign up free to listen. Transcripts are free to read.
Welcome everyone! Today, we’re going to explore the concept of APIs. Can anyone tell me what an API is?
Isn't it something that allows different software to communicate?
Exactly! An API, or Application Programming Interface, facilitates communication between software systems. This is especially important in QA to ensure everything is functioning correctly.
I heard there are different types of APIs. Which ones do we focus on in QA?
Good question! In QA, we primarily deal with REST APIs, which follow the HTTP protocol and typically return data in JSON or XML format.
So, what does REST stand for?
REST stands for Representational State Transfer. It has some important properties; for example, REST APIs are stateless, meaning each call is independent, and they rely on resource-based URLs.
That helps make it easier to work with them!
Correct! Let’s summarize: APIs allow communication, and REST APIs are key in QA for their stateless, resource-based nature.
Now, let's discuss the common HTTP methods used with REST APIs. Can someone list them?
GET, POST, PUT, and DELETE?
Exactly! Each method carries a specific function. For example, GET retrieves data, while POST creates new data. Can anyone provide examples of when they might use these methods?
I would use GET to get all users from an API.
And I'd use POST to create a new user account!
Great examples! Remember: GET, POST, PUT, and DELETE form the basis of how we interact with APIs in a RESTful architecture.
Can you explain the PUT method again?
Sure! PUT is used to update existing data. For instance, if you wanted to update a user's profile, you would use PUT.
Okay, that makes sense! It’s all about CRUD operations!
Exactly! Let's recap: the key HTTP methods are GET, POST, PUT, and DELETE, each serving a unique purpose in API interactions.
Next, we’ll look at how to use Postman for sending requests. Have any of you used it before?
I’ve heard of it but never used it!
No problem! Postman has a user-friendly interface. You start with the Request Builder where you choose the HTTP method and enter the API URL. Let’s break this down.
What are the other tabs available?
Excellent question! There’s the Headers tab for setting headers like Content-Type, the Body tab for including data, and the Params tab for adding query parameters.
And what do you do with the Send button?
The Send button executes the request! After sending the request, you can view the response including status codes and the response body.
Can we look at a real example?
Absolutely! If you select GET and enter the URL 'https://api.example.com/users', then click Send, you’ll see a JSON response of the users.
That seems simple enough!
Reinforcing the key points, Postman’s Request Builder, Headers tab, Body tab, and Response Viewer are crucial for effective API testing.
Now, let’s discuss how to write assertions in Postman. What do you think assertions are?
Are they checks to validate what the API returns?
That's correct! In Postman, assertions are written in the Tests tab using JavaScript. You can check for things like status codes or specific fields in the response.
Can you give a sample assertion?
Sure! For example, to check if the status code is 200, you would write: pm.test('Status code is 200', function() { pm.response.to.have.status(200); });
And how do we check if a specific field exists in the JSON response?
Great question! You could write something like: var jsonData = pm.response.json(); pm.expect(jsonData.name).to.eql('Charlie'); This checks that the response contains a field named name with the value Charlie.
So, we can automate the validation of APIs!
Exactly! Assertions are a powerful way to automate response validation, ensuring our APIs function correctly. Let's recap: Assertions in Postman allow you to validate various aspects of the response through JavaScript.
APIs allow software to talk, sending data, it’s quite the walk.
Imagine you're a librarian, using a catalog system (the API) to communicate what books (data) are checked out or available. The REST methods are like requests to check, add, or change stats about these books.
Remember CRUD: Create, Read, Update, Delete for the main HTTP methods.
R-E-S-T: Resource-based, Each request is stateless, Standard HTTP methods, Transfer of data.
Term
What is an API?
Click to flip
Term
What does REST stand for?
Click to flip
Term
What is the purpose of a POST request?
Click to flip
Application Programming Interface, a set of rules that allows different software applications to communicate with each other.
A type of API that adheres to REST architectural constraints, allowing interaction via HTTP methods.
Each call made to a REST API is independent and does not rely on previous calls.
Methods used in HTTP requests, including GET, POST, PUT, DELETE, etc.
Conditions or statements made to check the validity of data returned from an API.
API testing is crucial for ensuring the reliability and correctness of applications, and Postman serves as an intuitive tool for testing APIs efficiently.
As APIs become increasingly vital for application functioning, API testing has emerged as a fundamental practice in quality assurance. Postman simplifies the API testing process, enabling users to send requests, receive responses, and validate data without complex coding. This section covers key API concepts, RESTful architecture, and practical Postman operations, making it an essential read for aspiring QA professionals.
API testing is essential in modern software development as it ensures seamless communication between different software systems. An API, or Application Programming Interface, provides the means for these interactions. In this section, we delve into REST APIs, characterized by their statelessness and resource-based structure, employing common HTTP methods like GET, POST, PUT, and DELETE.
Using Postman: Postman serves as an intuitive graphical user interface tool that allows QA professionals to send HTTP requests and analyze the results efficiently. It features a Request Builder for method selection and URL input, a Headers tab for setting request parameters, and a Response Viewer to analyze outcomes.
Writing Assertions: Users can write JavaScript-based tests in Postman's Tests tab which enable automatic validation of API responses. This includes checking status codes and verifying fields within the JSON response. The section concludes with an API testing checklist and a summary of fundamental concepts, equipping QA professionals with practical knowledge for effective API testing.