API Testing

Moving on to the next use of dynamic cli you can also send requests to an API and receive responses. There are three HTTP methods you can use as of now which are:

  • GET
  • POST
  • DELETE

Let’s see how to use them one by one, for this tutorial I am going to use reqres.in which is a platform to make sample AJAX requests.

Also once you successfully get a response you can store in your local drive.

GET Method

To perform the GET HTTP method enter the following command to your terminal

dynamic -GET

After you press enter on your terminal it will ask you to enter the URL to make the request after that you will need to enter headers if your request needs headers you can add them then it will get the response and present to you in JSON format after that you will be asked if you want to save results if you press ‘Y’ then enter the file name you want to store your results in and press enter. 

GET Method

POST Method

To perform the POST HTTP method enter the following command to your terminal

dynamic -POST

In the POST method we send the payload(data) there are two ways using which you can send data in dynamic-cli. First, you will be asked to enter the URL then you can add headers then you will be asked if you want to send payload data or not if you press ‘Y’ you will be prompted with two choices which are

Sending Payload from terminal

If you choose first then you can send data from the terminal you need to specify data in key:value format just like we specify in the curl request.

After that, you can save the response.

 

Sending Payload from JSON file

If you choose option two you can send data from the JSON input file. You need to specify the name of the file and you will get the JSON response which you can save.

POST Method

DELETE Method

To perform the DELETE HTTP method enter the following command to your terminal

dynamic -DELETE

Same as other HTTP methods first you will be asked to enter the URL after that headers if the deletion operation is successful you will have the response with HTTP code 204 which represents no content.

DELETE Method


Introduction to Dynamic CLI in Python

In this article, we will see an introduction to Dynamic CLI in Python. 

Similar Reads

What is Dynamic CLI?

A Modern, user-friendly command-line HTTP client for API testing, It helps a programmer to code more efficiently by increasing one’s productivity and by reducing the time and effort required to perform tasks of searching for solutions and making API requests. So without wasting any further time let’s get right into it. Also using postman and other software for API testing are good but can be difficult for a beginner, dynamic-cli also provides the functionality of API testing where you can simply make API requests from your terminal....

Installation Using PIP

Use the following command...

Installation Using Virtual Environment

You can use this method to avoid possible issues with dependencies or permissions. This is recommended method...

Searching For Error

Now that dynamic CLI is installed correctly we can move forward and use it. Dynamic CLI offers different command-line arguments for different tasks such as for searching for something we use the command:...

Accessing Playbook

You started using dynamic CLI found multiple answers and saved them in the playbook but if you want to retrieve them later to do this you need to access a playbook that is stored in your local storage. To do that you can use the following command....

API Testing

Moving on to the next use of dynamic cli you can also send requests to an API and receive responses. There are three HTTP methods you can use as of now which are:...