PingFile is a command-line tool that allows you to execute API requests from configuration files defined in JSON, YAML, or PKFILE formats. It helps automate and manage API testing and execution, making it easier to work with various API configurations from a single command.
- Execute API requests from configuration files in multiple formats.
- Supports JSON, YAML, and PKFILE formats.
- Supports multiple API requests in a single configuration file.
- Colorful output with status codes, headers, and response body.
- Install the PingFile binary to your system's PATH for easy access.
-
Clone the repository:
git clone https://github.com/pradeepbgs/PingFile.git cd pingfile
-
Go to the
bin
directory:cd bin
-
Install the binary globally to your system's PATH:
chmod +x ./pingfile-linux
sudo ./pingfile-linux install
./pingfile-windows.exe install
Add C:\Users\dell\bin
to your system's PATH for easy access.
chmod +x ./pingfile-macos
sudo ./pingfile-macos install
- After installation, run PingFile with the following command:
pingfile
getrequest.json
{
"name":"Ping hello world /",
"url":"http://localhost:3000/",
"headers":{
"Method":"GET"
}
}
Run the command:
pingfile run getrequest.json
multi_apis.json
{
"name": "Global api/v1/users route",
"description": "This is a longer description for the API route.",
"version": "1.0.0",
"baseUrl": "http://localhost:3001",
"apis": [
{
"name": "Register",
"run": true,
"filePath": "zpkfile/register_response.json",
"saveResponse": true,
"includeCookie": false,
"url": "/api/v1/user/register",
"headers": { "Method": "POST" },
"body": {
"fullname":"pradeep kumar",
"username":"cityofdeadpeople",
"email": "[email protected]",
"password": "exvillager"
}
},
{
"name": "Login",
"run": true,
"filePath": "zpkfile/login_response.json",
"saveResponse": true,
"includeCookie": true,
"url": "/api/v1/user/login",
"headers": { "Method": "POST" },
"body": {
"email": "[email protected]",
"password": "linux"
}
},
{
"name": "Upload video",
"filePath": "pkfile/getApi.json",
"run": false,
"saveResponse": false,
"includeCookie": true,
"url": "/api/v1/video/upload",
"headers": { "Method": "POST" },
"body": {
"title": "Proompted Kiddies Learning The Hard Way",
"description": "Twitch / theprimeagen \nDiscord / discord"
},
"file": [
{ "name": "video", "path": "/home/pradeep/Downloads/video.mp4" },
{ "name": "thumbnail", "path": "/home/pradeep/Downloads/image.jpg" }
]
}
]
}
Run the command:
pingfile run multi_apis.json
- Use
--multithread
for concurrent requests. - Use
--save
to save the response to the specified file path.
pradeep@pradeep:~/Desktop/PingFile$ pingfile run apis.json
--------------- >>>>
Running PingFile for: apis.json
<<<<---------------
Status Code: 200 OK
Headers:
Cache-Control: [no-cache]
Content-Type: [text/plain; charset=utf-8]
X-Powered-By: [DieselJS]
Body:
Hello World!
API request executed successfully!
Feel free to contribute by opening issues or submitting pull requests.
This project is licensed under the MIT License.