JS API dataType Formats

This appendix outlines how to format the dataTypes that are used on the Javascript API.

Text Metadata Field

  • Usage: On the field_value parameter on the setMetadata function.
  • Format: Plain text. Code. Keyword Replacements.

For example:

Example Output
function setMetadata(100, 101, Abc123);  
Abc123  

Select Metadata Field

  • Usage: On the field_value parameter on the setMetadata function.
  • Format: The Key of the option.

For example, in the following setup:

Key Value
1a     Good  
1b     Average  
1c     Bad  
Example Output 
function setMetadata(100, 101, 1c);  
Bad  

Multiple Text Metadata Field

  • Usage: On the field_value parameter on the setMetadata function.
  • Format: Plain text. Code. Keyword Replacements (Multiple entries separated by semi-colons).
For example:

Example Output 
function setMetadata(100, 101, Aa; Bb; Cc);  
- Aa
- Bb
- Cc  

Date Metadata Field

  • Usage: On the field_value parameter on the setMetadata function.
  • Format: Y-m-d H:i:s OR keywords (%asset_created%, %asset_updated%, %asset_published%)

For example: 

Example Output 
function setMetadata(100, 101, 2001-01-01 01:01:01);  
2001-01-01 01:01:01  

Thesaurus Metadata Field

  • Usage: On the field_value parameter on the setMetadata function.
  • Format: The Thesaurus Term name.
For example, in the following setup:

An example Thesaurus

Example Output 
function setMetadata(100, 101, Giraffe);  
Giraffe (id: #963:2)  

Hierarchy Metadata Field

  • Usage: On the field_value parameter on the setMetadata function.
  • Format: The Option Key of the option.

For example, in the following setup:

Option Key Option Value
a   Fruit  
a1   Apple  
a1a   Granny Smith  
a2   Orange  
b     Vegetable   
Example Output 
function setMetadata(100, 101, a1);  
Apple  

WYSIWYG Metadata Field

  • Usage: On the field_value parameter on the setMetadata function.
  • Format: Plain text. Code. Keyword Replacements.

For example:

Example Output 
function setMetadata(100, 101,
Welcome to the %asset_name% page.
Click <a href=www.example.com>here</a>
to join. <ul>JOIN NOW!</ul>
);  
Welcome to the Home page.
Click here to join.
JOIN NOW!
  • Usage: On the field_value parameter on the setMetadata function.
  • Format: Asset ID.  

For example:

Example Output 
function setMetadata(100, 101, 240);  
Home Page (id: #240)