Common Port Numbers API

API is published to Rapid API Marketplace.

In order to use it, you have to register at Rapid API and sign up for CommonPortNumbers API.


RapiAPI Sign Up fo key

API contains only one HTTP GET endpoint called commonports.

The URL is "https://commonportnumbers.p.rapidapi.com/commonportnames".

API Parameters

Required parameters have to be passed in the request header:

  1. X-RapidAPI-Key
  2. X-RapidAPI-Host
Optional parameters are mimicing the form on this website and can be passed via URL
  1. port
  2. service
  3. protocol

Response

Response is a JSON array with the following properties:

[
                  {
                    "ServiceName": "domain",
                    "PortNumber": "53",
                    "PortType": "System Port",
                    "TransportProtocol": "tcp",
                    "Description": "Domain Name Server",
                    "Reference": "N/A",
                    "Source": "Internet Assigned Numbers Authority (IANA)",
                    "Notes": ""
                  }
                ]

Code Samples

Rapid API contains myriad of code samples to help you to get started much faster.

Here are C#,PowerShell & Python (yes, just those cause I like them =P) samples for your reference.

C#

var client = new HttpClient();
            var request = new HttpRequestMessage
            {
            	Method = HttpMethod.Get,
            	RequestUri = new Uri("https://commonportnumbers.p.rapidapi.com/commonportnames?port=53&protocol=tcp"),
            	Headers =
            	{
            		{ "X-RapidAPI-Key", "SIGN-UP-FOR-KEY" },
            		{ "X-RapidAPI-Host", "commonportnumbers.p.rapidapi.com" },
            	},
            };
            using (var response = await client.SendAsync(request))
            {
            	response.EnsureSuccessStatusCode();
            	var body = await response.Content.ReadAsStringAsync();
            	Console.WriteLine(body);
            }

PowerShell

$headers=
            $headers.Add("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
            $headers.Add("X-RapidAPI-Host", "commonportnumbers.p.rapidapi.com")
            $response = Invoke-RestMethod -Uri 'https://commonportnumbers.p.rapidapi.com/commonportnames?port=53&protocol=tcp' -Method GET -Headers $headers

Python

import http.client
            conn = http.client.HTTPSConnection("commonportnumbers.p.rapidapi.com")
            headers = {
                'X-RapidAPI-Key': "SIGN-UP-FOR-KEY",
                'X-RapidAPI-Host': "commonportnumbers.p.rapidapi.com"
                }
            conn.request("GET", "/commonportnames?port=53&protocol=tcp", headers=headers)
            res = conn.getresponse()
            data = res.read()
            print(data.decode("utf-8"))

Get Started at RapidAPI Quick Start Guide.

Github icon Twitter icon Coffee icon
© 2024 AndySvints
Design by Tristan Johnson , Filipe Kiss & sora.
Icons made by Freepik from www.flaticon.com.
An error has occurred. This application may no longer respond until reloaded. Reload 🗙