Certificates

A Certificate is a way to store your custom SSL certificate for your Files.com site. Files.com is also capable of registering SSL certificates itself, so this is only required if you have specific security requirements to use your own certificate.

List Certificates

SDK Function

Certificate.list()

Return Object

ListIterator<Certificate>

Authorization Requirement

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

Additional Arguments

Example Request

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

try {
  HashMap<String, Object> parameters = new HashMap<>();
  ListIterator<Certificate> certificates = Certificate.list(parameters);
  for (Certificate certificate : certificates.listAutoPaging()) {
    // Operate on certificate
  }
} 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 Certificate

SDK Function

Certificate.find()

Return Object

Certificate

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
Certificate ID.

Example Request

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

try {
  HashMap<String, Object> parameters = new HashMap<>();
  Certificate certificate = Certificate.find(id, parameters);
  // Operate on certificate
} 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 CSR or import existing SSL Certificate

SDK Function

Certificate.create()

Return Object

Certificate

Authorization Requirement

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

Function Arguments

ArgumentDescription
name
string
Required
Internal name of the SSL certificate.
certificate_domain
string
Domain for certificate.
certificate_extra_domains
array(string)
Additional domains for the certificate CSR.
certificate_country
string
Country.
certificate_state_or_province
string
State or province.
certificate_city_or_locale
string
City or locale.
certificate_company_name
string
Company name.
csr_ou1
string
Department name or organization unit 1
csr_ou2
string
Department name or organization unit 2
csr_ou3
string
Department name or organization unit 3
certificate_email_address
string
Email address for the certificate owner.
key_type
string
Any supported key type. Defaults to RSA-4096.
certificate
string
The certificate. PEM or PKCS7 formats accepted.
private_key
string
Certificate private key.
password
string
Certificate password.
intermediates
string
Intermediate certificates. PEM or PKCS7 formats accepted.

Example Request

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

try {
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("name", "Name");
  
  Certificate certificate = Certificate.create(parameters);
  // Operate on certificate
} 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());
}

Activate SSL Certificate

SDK Function

certificate.activate();

Return Object

No return value.

Authorization Requirement

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

Attribute Setters

SetterDescription
setReplaceCert
string
Leave blank or set to any to replace any currently active certificate, if applicable. Set to new_ips to activate this certificate as an additional certificate on your Site by allocating a new set of Dedicated IPs (may require a Plan upgrade). Set to the ID of a currently active certificate to replace that certificate on its set of dedicated IPs. A certificate belonging to a Custom Domain activates only for that domain: leave blank, use any, or specify that domain's current certificate ID.

Example Request

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

try {
  // Find the certificate object by its id.
  Certificate certificate = Certificate.find(id, null);
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("replace_cert", "");
  certificate.activate(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());
}

Deactivate SSL Certificate

SDK Function

certificate.deactivate();

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.Certificate;

try {
  // Find the certificate object by its id.
  Certificate certificate = Certificate.find(id, null);
  certificate.deactivate(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());
}

Replace this active custom SSL Certificate for the Primary Custom Domain with a Files.com SSL Certificate. The Primary Custom Domain's CNAME record must point at the Site's subdomain. The Files.com certificate is issued and activated in the background

SDK Function

certificate.replaceWithFiles();

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.Certificate;

try {
  // Find the certificate object by its id.
  Certificate certificate = Certificate.find(id, null);
  certificate.replaceWithFiles(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());
}

Update Certificate

SDK Function

certificate.update();

Return Object

Certificate

Authorization Requirement

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

Attribute Setters

SetterDescription
setName
string
Internal certificate name.
setIntermediates
string
Any intermediate certificates. PEM or PKCS7 formats accepted.
setCertificate
string
The certificate. PEM or PKCS7 formats accepted.

Example Request

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

try {
  // Find the certificate object by its id.
  Certificate certificate = Certificate.find(id, null);
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("name", "My Certificate");
  certificate.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 Certificate

SDK Function

certificate.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.Certificate;

try {
  // Find the certificate object by its id.
  Certificate certificate = Certificate.find(id, null);
  certificate.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 Certificate Object

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

AttributeDescription
id
int64
Certificate ID
name
string
Descriptive name of certificate
custom_domain_id
int64
Custom Domain that owns this certificate, including while the certificate is inactive.
certificate
string
Full text of SSL certificate
created_at
date-time
Certificate created at
display_status
string
Certificate status. (One of Request Generated, New, Active, Active/Expired, Expired, or Available)
domains
array(string)
Domains on this certificate other than files.com domains
expires_at
date-time
Certificate expiration date/time
brick_managed
boolean
Is this certificate automatically managed and renewed by Files.com?
intermediates
string
Intermediate certificates
ip_addresses
array(string)
A list of IP addresses associated with this SSL Certificate
issuer
string
X509 issuer
key_type
string
Type of key
request
string
Certificate signing request text
status
string
Certificate status (Request Generated, New, Active, Active/Expired, Expired, or Available)
subject
string
X509 Subject name