POST - Import a Zone

Purpose

This API call imports external BIND zone files into DDI Central database . It enables administrators to seamlessly migrate or update zone configurations in bulk using standard BIND file format. It also offers a replace option that provides the flexibility in either overwriting or merging with existing configurations.

Request URL

Method: POST

https://{appconsole_IP}:{9443}/v1/dns/import_bind/

Request Headers

The following headers must be included in the API request for successful authentication and data submission:

Authorization: DDI Central's OAuth implementation uses the Bearer authentication scheme. Hence, while making API calls, access_token obtained via the OAuth 2.0 Client Credentials Grant must be included in the Authorization header of API requests. This token verifies the client’s identity and ensures appropriate permissions for accessing resources.

The Authorization Header follows the format below:

headers = { "Authorization": "Bearer {bearer_tk}" }


Content-Type: Required in the header to indicate the media type of the resource being sent. It helps the server at the receiving end understand how to process the transmitted request body.

The Content-Type Header follows the format below:

headers ={ "Content-Type": "multipart/form-data" }

Request Body

  • zoneid* long
    • The unique identifier of the DNS zone where the BIND configuration will be imported.
    • Example: 7207.
  • config* Zone file in binary format
    • Config: The form field name in the API request where the file will be uploaded.
    • Specify the exact name of the file to be sent.
    • The full BIND zone file must be provided in binary format.
  • replace boolean
    • Determines whether the existing zone file should be replaced with the imported one.
    • true: Replaces the existing zone file.
    • false: Merges new records into the existing configuration.
    • Default: true.

 

- Mandatory parameter.

 

Sample Request (Python)

Copied
{
import requests

url = "https://10.16.11.249:9443/v1/dns/import_bind/"

payload = {}
files=[
  ('config',('ddi.com.txt',open('/C:/Users/test/Downloads/ddi.com.txt','rb'),'text/plain'))
]
headers = {
  'Authorization': 'Bearer V2l17hXtbECyC2dqOwLGJKEMepP6On'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

}

                                  

Sample Response

Copied
{
"Message":"Imported the Zone file successfully."
}