Custom Domains

A CustomDomain object represents an additional customer-owned domain that routes to a Files.com site.

List Custom Domains

SDK Function

CustomDomain.list()

Return Object

ListIterator<CustomDomain>

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Additional Arguments

Example Request

import com.files.ListIterator;
import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.CustomDomain;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  ListIterator<CustomDomain> customDomains = CustomDomain.list(parameters);
  for (CustomDomain customDomain : customDomains.listAutoPaging()) {
    // Operate on customDomain
  }
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Show Custom Domain

SDK Function

CustomDomain.find()

Return Object

CustomDomain

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Function Arguments

ArgumentDescription
id
int64
Required
Custom Domain ID.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.CustomDomain;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  CustomDomain customDomain = CustomDomain.find(id, parameters);
  // Operate on customDomain
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Create Custom Domain

SDK Function

CustomDomain.create()

Return Object

CustomDomain

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator.

Function Arguments

ArgumentDefaultDescription
available_to_all_workspaces
boolean
falseAllow all workspaces to use this default-workspace Custom Domain.
workspace_id
int64
0Workspace ID (0 for the default workspace).
destination
string
"site_alias"Where this custom domain routes. Can be site_alias, public_hosting, s3_endpoint, file_content, or unassigned (not routing traffic). Each Site can have one File Content domain in its default workspace. It applies to the whole Site and uses the Site's existing dedicated HTTPS IPs. Set to unassigned automatically when a bound public_hosting folder behavior is deleted, and can be set manually via the API for any reason.
Possible values: site_alias, public_hosting, s3_endpoint, unassigned, file_content
folder_behavior_id
int64
Public Hosting behavior ID when this domain routes to a specific Public Hosting behavior. Preserved as historical context when destination becomes unassigned.
ssl_certificate_id
int64
Current SSL certificate ID.
domain
string
Required
Customer-owned domain name.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.CustomDomain;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("domain", "files.example.com");
  
  CustomDomain customDomain = CustomDomain.create(parameters);
  // Operate on customDomain
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Allocate dedicated IP addresses to this Custom Domain

SDK Function

CustomDomain.createAllocateIp()

Return Object

CustomDomain

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator.

Function Arguments

ArgumentDescription
id
int64
Required
Custom Domain ID.
count
int64
Required
Number of dedicated IP addresses to allocate.
Possible values: 1, 2

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.CustomDomain;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("count", 1);
  
  CustomDomain customDomain = CustomDomain.createAllocateIp(id, parameters);
  // Operate on customDomain
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Update Custom Domain

SDK Function

customDomain.update();

Return Object

CustomDomain

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator.

Attribute Setters

SetterDescription
setAvailableToAllWorkspaces
boolean
Allow all workspaces to use this default-workspace Custom Domain.
setWorkspaceId
int64
Workspace ID (0 for the default workspace).
setDestination
string
Where this custom domain routes. Can be site_alias, public_hosting, s3_endpoint, file_content, or unassigned (not routing traffic). Each Site can have one File Content domain in its default workspace. It applies to the whole Site and uses the Site's existing dedicated HTTPS IPs. Set to unassigned automatically when a bound public_hosting folder behavior is deleted, and can be set manually via the API for any reason.
Possible values: site_alias, public_hosting, s3_endpoint, unassigned, file_content
setFolderBehaviorId
int64
Public Hosting behavior ID when this domain routes to a specific Public Hosting behavior. Preserved as historical context when destination becomes unassigned.
setSslCertificateId
int64
Current SSL certificate ID.
setDomain
string
Customer-owned domain name.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.CustomDomain;

try {
  // Find the customDomain object by its id.
  CustomDomain customDomain = CustomDomain.find(id, null);
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("available_to_all_workspaces", false);
  customDomain.update(parameters);
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Delete Custom Domain

SDK Function

customDomain.delete();

Return Object

No return value.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.CustomDomain;

try {
  // Find the customDomain object by its id.
  CustomDomain customDomain = CustomDomain.find(id, null);
  customDomain.delete(null);
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

The CustomDomain Object

Some of the functions above return a CustomDomain object. The attributes of this object are listed below.

AttributeDescription
id
int64
Custom Domain ID.
workspace_id
int64
Workspace ID (0 for the default workspace).
available_to_all_workspaces
boolean
Allow all workspaces to use this default-workspace Custom Domain.
outbound_ip_addresses
array(string)
Eligible public IP addresses for Remote Server outbound connections. Empty when this Custom Domain is not eligible for outbound selection.
domain
string
Customer-owned domain name.
destination
string
Where this custom domain routes. Can be site_alias, public_hosting, s3_endpoint, file_content, or unassigned (not routing traffic). Each Site can have one File Content domain in its default workspace. It applies to the whole Site and uses the Site's existing dedicated HTTPS IPs. Set to unassigned automatically when a bound public_hosting folder behavior is deleted, and can be set manually via the API for any reason.
Possible values: site_alias, public_hosting, s3_endpoint, unassigned, file_content
dns_status
string
Current DNS verification status.
Possible values: disabled, correct, no_records, cname_wrong, a_record, caa_conflict
ssl_certificate_id
int64
Current SSL certificate ID.
brick_managed
boolean
Is this domain's SSL certificate automatically managed and renewed by Files.com?
folder_behavior_id
int64
Public Hosting behavior ID when this domain routes to a specific Public Hosting behavior. Preserved as historical context when destination becomes unassigned.
ip_addresses
array(string)
Dedicated public IP addresses allocated to this Custom Domain.
created_at
date-time
When this Custom Domain was created.
updated_at
date-time
When this Custom Domain was last updated.