NetConnect API Documentation
Base URL: https://webapi.pythonanywhere.com
Introduction
Welcome to the Network Connectivity API! This API provides a set of endpoints for network-related operations, including ping, DNS lookup, HTTP GET requests, and a network speed test.
Authentication
The Network Connectivity API does not currently require authentication. You can access the endpoints without an API key.
Endpoints
Ping Endpoint
Endpoint: /ping
Method: GET
Description: Performs a ping operation to check the reachability of a host.
Parameters:
host (string, required): The host to ping.
Example:
bash
curl https://webapi.pythonanywhere.com/ping?host=example.com
Responses:
Success (200 OK):
json
{
“result”: “Host is reachable”
}
Error (400 Bad Request):
json
{
“error”: “Host parameter is required”
}
Error (500 Internal Server Error):
json
{
"error": "Error: Unable to perform ping operation"
}
DNS Lookup Endpoint
Endpoint: /dns-lookup
Method: GET
Description: Performs a DNS lookup for a given host name, returning detailed information.
Parameters:
host (string, required): The host name to perform the DNS lookup.
Example:
bash
curl https://webapi.pythonanywhere.com/dns-lookup?host=example.com
Responses:
Success (200 OK):
json
{
“result”: {
“host”: “example.com”,
“ip_address”: “93.184.216.34”,
“canonical_name”: “example.com.”,
“alias_records”: [],
“additional_ip_addresses”: [“2606:2800:220:1:248:1893:25c8:1946”]
}
}
Error (400 Bad Request):
json
{
“error”: “Host parameter is required”
}
Error (500 Internal Server Error):
json
{
"error": "Error: Unable to perform DNS lookup"
}
HTTP GET Endpoint
Endpoint: /http-get
Method: GET
Description: Sends an HTTP GET request to the specified URL and returns the response.
Parameters:
url (string, required): The URL to send the HTTP GET request.
Example:
bash
curl https://webapi.pythonanywhere.com/http-get?url=https://www.example.com
Responses:
Success (200 OK):
json
{
“result”: “Response content from the specified URL”
}
Error (400 Bad Request):
json
{
“error”: “URL parameter is required”
}
Error (500 Internal Server Error):
json
{
"error": "Error: Unable to perform HTTP GET request"
}
Network Speed Test Endpoint
Endpoint: /network-speed-test
Method: GET
Description: Estimates the download speed by downloading a test file.
Example:
bash
curl https://webapi.pythonanywhere.com/network-speed-test
Responses:
Success (200 OK):
json
{
“download_speed”: 1234.56789,
“unit”: “KB/s”
}
Error (500 Internal Server Error):
json
{
“error”: “Error: Unable to perform network speed test”
}