Bulk-imports domains into the specified preset domain group from an uploaded file.
Reference
POST https://YOUR-NETWORK-DOMAIN/rest-api/preset-domain/group/upload-domains.do
Bulk-imports domains into the specified preset domain group from an uploaded file. The file should contain one domain per line. A special DMCA zip file format is also supported for copyright-related domain lists. Returns a JSON object with import statistics including the number of processed records. Requires PRESET_DOMAIN_GROUP_MANAGEMENT permission. The action is recorded in the audit log.
Query Params
groupIdintegerrequired
Unique numeric ID of the preset domain group to import domains into
import fs from 'node:fs/promises';
const form = new FormData();
form.append('file', new Blob([await fs.readFile('data.csv')]), 'data.csv');
const response = await fetch('https://YOUR-NETWORK-DOMAIN/rest-api/preset-domain/group/upload-domains.do?groupId=100', {
method: 'POST',
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
body: form,
});
console.log(await response.json());
Java Request
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://YOUR-NETWORK-DOMAIN/rest-api/preset-domain/group/upload-domains.do?groupId=100"))
.header("X-Api-Key", "YOUR_API_KEY")
// multipart upload: build the body with your HTTP library of choice
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
C# Request
using var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("POST"), "https://YOUR-NETWORK-DOMAIN/rest-api/preset-domain/group/upload-domains.do?groupId=100");
request.Headers.Add("X-Api-Key", "YOUR_API_KEY");
var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(File.ReadAllBytes("data.csv")), "file", "data.csv");
request.Content = form;
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Go Request
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("POST", "https://YOUR-NETWORK-DOMAIN/rest-api/preset-domain/group/upload-domains.do?groupId=100", nil)
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
// multipart upload: build the body with mime/multipart
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}