Metadata Categories

A MetadataCategory defines a reusable set of Custom Metadata rules that can be assigned to folders via a folder behavior. Each category specifies named metadata keys with optional allowed-value constraints, and a set of default columns to display in the UI.

If a key's allowed_values array is empty, it is treated as a free-form text field. If the array is non-empty, the key is constrained to those values in the Web UI.

List Metadata Categories

SDK Function

MetadataCategory.list()

Return Object

ListIterator<MetadataCategory>

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

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

try {
  HashMap<String, Object> parameters = new HashMap<>();
  ListIterator<MetadataCategory> metadataCategories = MetadataCategory.list(parameters);
  for (MetadataCategory metadataCategory : metadataCategories.listAutoPaging()) {
    // Operate on metadataCategory
  }
} 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 Metadata Category

SDK Function

MetadataCategory.find()

Return Object

MetadataCategory

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Function Arguments

ArgumentDescription
id
int64
Required
Metadata Category ID.

Example Request

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

try {
  HashMap<String, Object> parameters = new HashMap<>();
  MetadataCategory metadataCategory = MetadataCategory.find(id, parameters);
  // Operate on metadataCategory
} 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());
}

List Metadata Categories by Path

SDK Function

MetadataCategory.listFor()

Return Object

ListIterator<MetadataCategory>

Authorization Requirement

Available to all authenticated keys or sessions.

Function Arguments

ArgumentDescription
path
string
Required
Path to operate on.

Additional Arguments

Example Request

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

try {
  HashMap<String, Object> parameters = new HashMap<>();
  ListIterator<MetadataCategory> metadataCategories = MetadataCategory.listFor(path, parameters);
  for (MetadataCategory metadataCategory : metadataCategories.listAutoPaging()) {
    // Operate on metadataCategory
  }
} 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 Metadata Category

SDK Function

MetadataCategory.create()

Return Object

MetadataCategory

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Function Arguments

ArgumentDescription
name
string
Required
Name of the metadata category.
default_columns
array(string)
Metadata keys that should appear as columns in the UI by default.

Example Request

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

try {
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("name", "Approval Workflow");
  
  MetadataCategory metadataCategory = MetadataCategory.create(parameters);
  // Operate on metadataCategory
} 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 Metadata Category

SDK Function

metadataCategory.update();

Return Object

MetadataCategory

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Attribute Setters

SetterDescription
setName
string
Name of the metadata category.
setDefaultColumns
array(string)
Metadata keys that should appear as columns in the UI by default.

Example Request

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

try {
  // Find the metadataCategory object by its id.
  MetadataCategory metadataCategory = MetadataCategory.find(id, null);
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("name", "Approval Workflow");
  metadataCategory.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 Metadata Category

SDK Function

metadataCategory.delete();

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Example Request

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

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

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

AttributeDescription
id
int64
Metadata Category ID
name
string
Name of the metadata category.
definitions
hash(string,array(string))
Map of key names to arrays of allowed values. An empty array means free-form text.
default_columns
array(string)
Metadata keys that should appear as columns in the UI by default.