/v1/api/list/dns/{domainListId}/attachFile (POST) - BlueCat DNS Edge

DNS Edge API Guide

prodname
BlueCat DNS Edge
Uploads a CSV file containing a list of domain names to an existing DNS list.
Note: The client device from which you log in to the DNS Edge web application must allow multipart/form-data uploads.
POST https://api-<DNS.Edge.URL>/v1/api/list/dns/{domainListId}/attachfile
Authorization: Bearer authorization token
Content-type: multipart/form-data
File that contains the domains

Python example

import requests Headers = {"Authorization": "<token>"} Dict = {'file':('myFile.txt', 
open('myFile.txt', 'rb'), 'text/plain')} response = requests.post("https://<DNSEdge FQDN>
/v1/api/list/dns/<domain list id>/attachfile", files=Dict, headers=Headers) print(response.content)

Curl example

`curl -X POST https://<DNSEdge FQDN>/v1/api/list/dns/<id>/attachfile -d @<path to file>
 -H "Content-Type: multipart/form-data" -H "Authorization: Bearer <token>"`

Successful response

200 OK
{
"numOfValidDomains": "validDomains",
"numOfInvalidDomains": "invalidDomains",
"numOfDuplicateDomains": "duplicateDomains",
"errors": {
   "lineNumber": "lineNumber" 
   "lineContents": "lineContents" 
   }
}
Possible error codes
  • CANNOT_ATTACH_FILE_TO_DYNAMIC_LIST
  • UNABLE_TO_UPLOAD_DN_LIST
  • LIST_DOES_NOT_EXIST
  • DOMAINLIST_ATTACHED_TO_NAMESPACE_EXCEED_100K_DOMAINS - Domain lists associated with namespaces can't exceed 100,000 domains
  • FAILED_TO_GET_ASSOCIATED_NAMESPACE - Error retrieving associated namespace
  • UNEXPECTED_ERROR