- 05 Jun 2024
- 2 Minutes to read
- Print
- DarkLight
Creating REST API Test in pCloudy
- Updated on 05 Jun 2024
- 2 Minutes to read
- Print
- DarkLight
REST (Representational State Transfer) API is an advanced method to transfer data in various formats. Due to its flexibility, REST APIs are the preferred method to transfer data in most web applications. Thus, testing REST APIs is imperative for organizations to ensure the smooth operation of their applications.
In pCloudy, you can create test cases for both SOAP and REST APIs in the API test section of Automate. For example, in testing a banking application, a REST API test suite might include cases to validate transactions, check account balances, and verify account information retrieval.
Each test case simulates different API requests and assesses the responses to ensure the API functions accurately and securely, providing crucial insights for development and maintenance.
In the following sections, we will create a REST API test case.
Hover over the Automate section and click the API Test category.
Now, click the Create API Test button to open the Create ApiTest window. In this window, add a name, priority, assignee, and description. Click Create.
Now, you will get an option to choose the service type. Select the REST service button as shown below.
A new file ‘New Node’ is added with an editable default name. You can change the name if required.
Enter a valid URI in the API Endpoint text box. We are using the URI:
https://official-joke-api.appspot.com/random_joke
You may need to provide authentication details from the Authentication Type dropdown if it’s required by the REST web service. We have added None as no authentication is required for this web service.
Note: You can see the authentication types supported by Opkey in the dropdown as shown below.
Click the add method icon to see that the URI gets broken down into Endpoint and Resource.
Now, send a request with call button as shown below.
After sending the request, scroll down to find the Response. The response shows the status as “200 OK” which means that the API call was successful.
Other Important Points
1. While adding a new method, the GET method is selected by default. However, you can select other methods from the dropdown at the top as shown below.
You can also add parameters like Query String, Request Header, and Request Body to perform different REST operations.
2. The GET method is used for getting back the requested data in the form of a response.
3. POST & PUT methods are used to Create and Update/Replace resources.
4. The Delete method is used to delete a given entry from the intended resource.
5. Apart from GET, when you use other methods (POST, PUT & DELETE), the Run command gets disabled.
You've reached the end of this article and are now well-prepared to create a REST API test case.