Protocol APIs
Protocol API
- Introduction
- Authentication
- Response Codes and Format
- Protocol Catalog API
- Protocol Categories API
- Protocol Release Log API
- Script Examples
Introduction
When integrating Netify into a user interface (UI), it is often necessary to present the end user with protocol information. Integrator API endpoints are available to fetch Netify's protocol list, categories, and release logs as JSON objects.
The following endpoints provide information on the protocols supported by the Netify Agent:
Data | Description |
---|---|
Protocol Catalog | The list of supported protocols. |
Protocol Categories | The list of categories used by protocols. |
Protocol Release Logs | The log of protocol additions and deletions. |
Authentication
To access these endpoints, an API key must be passed in the x-api-key parameter in the request headers. Please contact us for details about acquiring an API key.
Response Codes and Format
These integrator API endpoints provide payloads with the following top-level JSON properties:
- status_code: a status code number
- status_message: a human-readable status message
- status_fields: an array of validation errors (if any)
Additionally, the API sends standard HTTP response codes.
Code | Response |
---|---|
200 | OK |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
405 | Method Not Allowed |
409 | Conflict |
422 | Validation Error |
429 | Too Many Requests |
500 | Server Error |
Protocol Catalog API
Endpoint | https://agents.netify.ai/api/v2/integrator/protocols/catalog |
The Protocol Catalog provides a list of all the protocols - past and present - supported by the Netify Agent.
If the Netify agent version is passed to the API endpoint, the catalog results will only include the protocols supported in the specified version. You can specify the full version (e.g. 5.0.62), or a major version number (e.g. 5.0 for all version 5.0.x releases).
ID and Tag
You can identify a protocol by ID number (e.g. 120). The tag is only intended for user interfaces (UIs) and internal use -- it is not used in the Netify Agent. You can browse the list of IDs in the protocols catalog.
Label / Full Label
The label is the name an end user would typically use to identify a protocol, while the full_label (if shown) provides a more formal name.
Abbreviation
The abbreviation is provided if it is in wide use.
Description
The description is a one or two-sentence description of the protocol.
Home Page
The home_page provides the link to the protocol home page.
Category
Every protocol is listed under a category. You can find a list of protocol categories and associated IDs/tags here.
Introduced
The Netify Agent version where the protocol was introduced.
Deprecated
The Netify Agent version where the protocol was deprecated.
Protocol Object - JSON Example
{
"id": 96,
"tag": "tftp",
"label": "TFTP",
"full_label": "Trivial File Transfer...",
"abbreviation": "TFTP",
"description": "Trivial File ...",
"home_page": {
"url": "",
"text": ""
},
"category": {
"id": 4,
"tag": "file-server",
"label": "File Server"
},
"introduced": "2.88",
"deprecated": ""
}
Protocol Categories API
Protocol Categories | https://agents.netify.ai/api/v2/integrator/protocols/categories |
Every protocol is listed under a category. You can find a list of protocol categories and associated IDs/tags here.
The category API provides a standard id, tag and label for each category.
Protocol Category - JSON Example
{
"id": 3,
"tag": "advertiser",
"label": "Advertiser"
},
{
"id": 4,
"tag": "entertainment",
"label": "Arts and Entertainment"
},
...
Protocol Release Log API
Endpoint | https://agents.netify.ai/api/v2/integrator/protocols/releaselog |
The Protocol Release Log provides protocol additions and deletions in release order.
Script Examples
Curl
curl -H 'x-api-key: {api_key}' https://agents.netify.ai/api/v2/integrator/protocols/catalog
curl -H 'x-api-key: {api_key}' https://agents.netify.ai/api/v2/integrator/protocols/categories
curl -H 'x-api-key: {api_key}' https://agents.netify.ai/api/v2/integrator/protocols/releaselog
Python
Copy and save the Python script below to a file named, for example, netify.py
, and execute. The script provided is just a demonstration of sample metadata available and how
to format (ex. CSV). Feel free to modify the scripts to access any JSON attributes available in the raw data.
python3 netify.py --csv protos
"ID","Label","Category","Homepage"
"30139","Citrix Online","Remote Desktop","https://en.wikipedia.org/wiki/Citrix_Online"
"30118","Meebo","Messaging","https://en.wikipedia.org/wiki/Meebo"
..
.
"0","Unclassified","Unclassified",""
To get the full JSON output, omit the --csv
option.
import os
import json
import requests
import sys
import getopt
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "c", ["csv"])
except getopt.GetoptError as err:
print(f"Error: {err}")
sys.exit(2)
api_key = os.getenv('NETIFY_API_KEY')
if not api_key:
print("Netify API key not set in environment variable NETIFY_API_KEY")
sys.exit(2)
csv = False
for opt, _ in opts:
if opt in ("-c", "--csv"):
csv = True
if len(args) != 1 or args[0] not in ("apps", "protos"):
print("Usage: netify.py [-c] ")
sys.exit(2)
resource = args[0]
if resource == "apps":
url = 'https://agents.netify.ai/api/v2/integrator/applications/catalog'
else:
url = 'https://agents.netify.ai/api/v2/integrator/protocols/catalog'
headers = {
'content-type': 'application/json',
'x-api-key': api_key
}
response = requests.get(url, headers=headers)
if response.status_code != 200:
print(response.json())
sys.exit(2)
data = response.json()['data']
if csv == True:
print('"ID","Label","Category","Homepage"')
for d in data:
if csv == True:
print('"%d","%s","%s","%s"' % (d['id'], d['label'], d['category']['label'], d['home_page']['url']))
if csv == False:
jprint(data)
def jprint(obj):
text = json.dumps(obj, sort_keys=False, indent=4)
print(text)
if __name__ == "__main__":
main()