Api

API


Table of contents

API Service

A REST API is available for current RADb customers and is built to provide query and edits.

Under typical conditions committed edits are presented instantly

The API documentation at https://api.radb.net/docs.html.

Examples

Here are some example code that uses every function of the API via curl (Linux terminal) and/or via Python 3.7.

This will help maintainers/developers get a head start on using the API.

The example code shows how to:

  • Get routing objects by their primary keys
  • Search (the API apparently currently only supports inverse searches by mnt-- by)
  • Create/add new objects
  • Update existing objects
  • Remove existing objects

The types of objects supported:

  • as-set
  • aut-num
  • filter-set
  • inet-rtr
  • mntner
  • peering-set
  • person
  • role
  • route
  • route6
  • route-set
  • rtr-set

Authentication

In order to use the API, you must have authorization.

  • Navigate to https://api.radb.net/docs.html
  • Click the "authorize" button.
  • Under "BasicAuth", enter your RADb portal username and password and click "Authorize".
  • Under "IRRPasswordAuth", enter your RADb maintainer password and click "Authorize".
  • Close the authorization window.
  • Click GET/api/{source}/search
  • Click "Try it out"
  • Click "Execute"

This will generate your authorization header in the Curl section. It will look like this:

    Authorization: Basic XYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZ==

You can then use this information to use the API.

Curl Commands

Copy and paste the entire command including any newlines, if applicable. You will need to modify the code to match your specific situation.

GET Search

Returns plain-text format

curl -X GET "https://api.radb.net/api/radb/search?query-string=MAINT-AS64505&inverse-attribute=mnt-by&password=MyPlaintextMntnerPassWrd" -H  "accept: text/plain" -H  "Authorization: Basic XYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZ=="

Returns JSON format

curl -X GET "https://api.radb.net/api/radb/search?query-string=MAINT-AS64505&inverse-attribute=mnt-by&password=MyPlaintextMntnerPassWrd" -H  "accept: application/json" -H  "Authorization: Basic XYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZ=="

GET

Returns plain-text format

curl -X GET "https://api.radb.net/api/radb/mntner/MAINT-AS64505?password=MyPlaintextMntnerPassWrd" -H  "accept: text/plain" -H  "Authorization: Basic XYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZ=="

Returns JSON format

curl -X GET "https://api.radb.net/api/radb/mntner/MAINT-AS64505?password=MyPlaintextMntnerPassWrd" -H  "accept: application/json" -H  "Authorization: Basic XYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZ=="

POST

curl -X POST "https://api.radb.net/api/radb/aut-num?password=MyPlaintextMntnerPassWrd" -H  "accept: text/plain" -H  "Authorization: Basic XYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZ==" -H  "Content-Type: text/plain" -d
'
aut-num:    AS64505
as-name:    ASTEST64505
descr:      Testing RADb API for documentation
admin-c:    Me Myself I
tech-c:     Someone else
notify:     someone@example.com
mnt-by:     MAINT-AS64505
changed:    someone@example.com 20190801
source:     RADB
'

PUT

curl -X PUT "https://api.radb.net/api/radb/aut-num/AS64505?password=MyPlaintextMntnerPassWrd" -H  "accept: text/plain" -H  "Authorization: Basic XYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZ==" -H  "Content-Type: text/plain" -d
'
aut-num:    AS64505
as-name:    ASTEST64505
descr:      Testing RADb API for documentation updated2
admin-c:    Me Myself I
tech-c:     Someone else
notify:     someone@example.com
mnt-by:     MAINT-AS64505
changed:    someone@example.com 20190801
source:     RADB
'

DELETE

curl -X DELETE "https://api.radb.net/api/radb/aut-num/AS64505?password=MyPlaintextMntnerPassWrd" -H  "accept: text/plain" -H  "Authorization: Basic XYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZXYZ==" -H  "Content-Type: text/plain" -d
'
aut-num:    AS64505
as-name:    ASTEST64505
descr:      Testing RADb API for documentation updated2
admin-c:    Me Myself I
tech-c:     Someone else
notify:     someone@example.com
mnt-by:     MAINT-AS64505
changed:    someone@example.com 20190801
source:     RADB
delete:     contact@example.com reasons
'

Python

Here are some example script files written in Python that you can use to help develop your codebase.

Example Script

RADb API Example Script - Python 3.7

Helper functions

This python code includes some function definitions which can extract and modify attributes of RPSL objects.

RADb API Example Script - Help Functions

Need Assistance?

If you have technical questions or need help related to Merit RADb, please contact RADb Support.

Back to Support