Probe API

Probe API generates the HTTP request corresponding to each API present in the API documentation of the Swagger/OpenAPI JSON and execute them.

Probe API

Probe API offers a convenient way to crawl APIs present in the supported API documentation.

Supported API Documentations

API Documentation

Version

Options

Option

Description

--jsonUrl

Provide the URL pointing to the Supported API documentation.

--jsonFilePath

Provide the file path containing the API documentation JSON.

--baseUrl

Provide the application URL in case the application server and the API documentation server are running on different machines.

--config

Provide the config file path. How to setup config file?

It is mandatory to pass either --jsonUrl or --jsonFilePath. In case if both the option are provided, then --jsonUrl will be in effect as it has higher priority compared to --jsonFilePath.

Commands

  • Command to display the help page:

$ k2hackbot probe-api --help

  --jsonUrl TEXT       URL of the Swagger JSON
                       
                       Eg. k2hackbot probe-api --jsonUrl https://api-
                       documentation.com

  --jsonFilePath TEXT  File path of the Swagger JSON
                       
                       Eg. k2hackbot probe-api --jsonFilePath myfile.json
                       
                       Note: It is mandatory to pass either --jsonUrl or
                       --jsonFilePath. In case if both the option is provided,
                       then --jsonUrl will be in effect as it has higher
                       priority compared to --jsonFilePath.

  --baseUrl TEXT       Base URL of the application.
                       
                       Eg. k2hackbot probe-api --jsonUrl https://swagger-
                       json.com --baseUrl https://myapplication.com

  --config FILE        Read configuration from FILE.
  --help               Show this message and exit.
  • Command to crawl all the APIs from the API documentation using JSON URL:

k2hackbot probe-api --jsonUrl https://api-documentation.com
  • Command to crawl all the APIs from the API documentation using the JSON file:

k2hackbot probe-api --jsonFilePath myfile.json
  • Command to crawl API documentation when the Application server and the API documentation server are running on different machines:

k2hackbot probe-api --jsonUrl https://swagger-json.com --baseUrl https://myapplication.com

Config File Setup

K2HackBot support two ways to define options:

  • CLI

  • Config File

The Hierarchy for reading config is as follows:

CLI > Environment > Configuration file > Default

The config file can be created with any name but it MUST be in JSON format. Below is a sample config file for probe-api :

$ cat k2config.json

{
	"jsonUrl": "https://swagger-json.com",
	"baseUrl": "https://myapplication.com"
}

Command to run probe-api using the config file:

k2hackbot probe-api --config k2config.json

Last updated

Was this helpful?