Creating REST API Method in Opkey



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 Opkey, 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. 


1. Hover over the Automate section and click the API Test category. 


 

2. 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.


3.  Now, you will get an option to choose the service type. Select the REST service button as shown below. 


 




4. 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. Here we are using the URL: https://reqres.in/






You may need to provide authentication details from the Authentication Type dropdown if the REST web service requires it. 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. 





6. Click the add method icon.





7. You can see here that the URI gets broken down into Endpoint and Resource.

Now, send a request with the call button as shown below.





8. 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. 

Ready to dive deeper? Check out the next article: Creating a Test Suite

Explore, experiment, and achieve your testing goals on Opkey!




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article