Custom Fields API v2

Custom Fields API


The Custom Fields API allows you to retrieve, add and get custom fields of an asset. The following methods are available:

  • Custom Fields API
    • Get all custom fields
      • Method
      • Input Parameter
      • Output Value
      • REST: Sample Request
      • Sample Output
    • Add custom field
      • Method
      • Input Parameter
      • Output Value
      • REST: Sample Request
      • Sample Output
    • Get custom fields of asset
      • Method
      • Input Parameter
      • Output Value
      • REST: Sample Request
      • Sample Output
    • Set custom field value in bulk
      • Method
      • Input Parameter
      • Output Value
      • JSON parameter for field_values
      • REST: Sample Request
      • Sample Output
    • Set custom field value
      • Method
      • Input Parameter
      • Output Value
      • JSON parameter for field_values
      • REST: Sample Request
      • Sample Output

Get all custom fields


Method

Method Name

Returns

getall

Record set

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

Output Value

Name

Description

Sample Output

id

ID of the field

108

text

Text of the field

my custom field

type

What type the field is (text, textarea, etc.)

text

enabledIf the field is enabled in RazunaT
showFor which asset type the field is enabledall (default)
img = Images
vid = Videos
aud = Audios
doc = Documents
users = Users 

REST: Sample Request

/global/api2/customfield.cfc?method=getall&api_key=54592180-7060-4D4B-BC74-2566F4B2F943

Sample Output

{“columns”:[“id”,“text”,“enabled”,“type”,“show”],“data”:[“108”,“my custom field”,“T”,“text”,“all”]]}

:white_check_mark:** Output format**
Remember you can adjust the output dynamically. The API returns JSON by default. For record sets it defaults to a ROW based set, if you need COLUMNS simply append “&__BDQUERYFORMAT=column” to your call. In case, you need JSONP you want to append “&__BDRETURNFORMAT=jsonp&callback=?”. In order to retrieve XML (WDDX) you simply need to append “&__BDRETURNFORMAT=wddx”.

Add custom field


Method

Method Name

Returns

setfield

String

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

field_textThe text of the fieldStringyesmy custom field
field_typeType of the fieldStringyestext
textarea
radio (radio button)
select (select list)
select_multi (select multiple) as of Razuna 1.7.5
field_showTo what asset type should the field be enabledStringno

all (default)
img = Images
vid = Videos
aud = Audios
doc = Documents
users = Users 

field_enabledIs the field enabled within RazunaStringnoT = yes (default)
F = no 
field_select_listIf your field type is a select list, enter its values hereStringnovalue 1,value 2,value 3

Output Value

Name

Description

Sample Output

responsecode

Responsecode

0 (if successful)

message

Status Message

Custom field successfully added

field_id

ID of the new custom field

109

REST: Sample Request

/global/api2/customfield.cfc?method=setfield&api_key=CA1EBCFD45084E3991EA569DB10A29AA&field_text=location&field_type=text

Sample Output

{["responsecode":"0","message":"Custom field successfully added","field_id":"1110008"]}

Get custom fields of asset


Returns all custom fields from asset(s).

Method

Method Name

Returns

getfieldsofasset

Record set

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

asset_idID of the asset(s)Stringyes108
or a list like 108,109,etc. 
lang_idID of the language for the resultsStringno1 (default)

Output Value

Name

Description

Sample Output

field_id

ID of the custom field

109090

field_textText of the custom fieldlocation
field_valueValue of the custom field for this asset recordDenmark

REST: Sample Request

/global/api2/customfield.cfc?method=getfieldsofasset&api_key=CA1EBCFD45084E3991EA569DB10A29AA&asset_id=0D624466697B4A27A498E78373AE6FF3

Sample Output

{"columns":["field_id","field_text","field_value"],"data":[["A7A56950-C802-4CE7-B2A36BBE5B3F454D","Hotel
Rooms",""],["237503B5-BB08-4658-8E4EFC2759847F07","photopgrapher","F"],["6BC43A50-BB0D-42C9-B8FE309678048CB0","myselect","one"]]}

:white_check_mark: Output format
Remember you can adjust the output dynamically. The API returns JSON by default. For record sets it defaults to a ROW based set, if you need COLUMNS simply append “&__BDQUERYFORMAT=column” to your call. In case, you need JSONP you want to append “&__BDRETURNFORMAT=jsonp&callback=?”. In order to retrieve XML (WDDX) you simply need to append “&__BDRETURNFORMAT=wddx”.

Set custom field value in bulk


Method

Method Name

Returns

setfieldvaluebulk

String

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

field_values

 JSON Structure

String

yes

JSON structure
See the example below

Output Value

Name

Description

Sample Output

responsecode

Responsecode

0 (if successful)

message

Status Message

Custom field values successfully added

JSON parameter for field_values

You pass the values for the custom fields as a JSON structure. The first parameter is the assetid, followed by a embedded JSON structure of the custom field ID and the custom field value. A example of passing the values would be (you need to serialize your array in order to pass it in a URL):

[["1ABB08AA3B47402CB4BF1B398F4CD6F8",[["255F307E-AE5A-4E66-AD2F6BBE81D0541C","value 1"],["7FD45BCC-F3ED-4C85-8CCCF50CDCE98E8E","value 2"]]]]

In a bulk statement for many files you would simple add them to the JSON structure as in:

[["1ABB08AA3B47402CB4BF1B398F4CD6F8",[["255F307E-AE5A-4E66-AD2F6BBE81D0541C","value 1"],["7FD45BCC-F3ED-4C85-8CCCF50CDCE98E8E","value 2"]]],["BB59AB4D207F41C79408E5DC04B8651A",[["FB3489CC-059E-424F-B448371E18DDE6A6","value 3"],["F72A20FE-D5EC-4CF0-98C689F6FE87CCB9","value 4"]]]]

REST: Sample Request

/global/api2/customfield.cfc?method=setfieldvaluebulk&api_key=CA1EBCFD45084E3991EA569DB10A29AA&field_values=[["1ABB08AA3B47402CB4BF1B398F4CD6F8",[["255F307E-AE5A-4E66-AD2F6BBE81D0541C","value 1"],["7FD45BCC-F3ED-4C85-8CCCF50CDCE98E8E","value 2"]]]]

Sample Output

{["responsecode":"0","message":"Custom field values successfully added"]}

Set custom field value


Bulk adding
You can also use the setfieldvaluebulk() method above in order to set many custom field values for many files at the same time!

Method

Method Name

Returns

setfieldvalue

String

Input Parameter

Parameter

Description

Type

Required

Sample Input

api_key

A valid API key

String

yes

54592180-7060-4D4B-BC74-2566F4B2F943

assetid

The id of the asset or a list of id's (delimited with a ",")

String

yes

108
or a list like 108,109,etc.

field_values

 JSON Structure

String

yes

JSON structure of metadata
See the metadata field list below

To set a value for select (multiple) simply comma separate the values!

Output Value

Name

Description

Sample Output

responsecode

Responsecode

0 (if successful)

message

Status Message

Custom field values successfully added

JSON parameter for field_values

You pass the values for the custom fields as a JSON structure. You also need to know the ID of the custom field. A example of passing the values would be (you need to serialize your array in order to pass it in a URL):

[["255F307E-AE5A-4E66-AD2F6BBE81D0541C","value 1"],["7FD45BCC-F3ED-4C85-8CCCF50CDCE98E8E","value 2"]]

REST: Sample Request

/global/api2/customfield.cfc?method=setfieldvalue&api_key=CA1EBCFD45084E3991EA569DB10A29AA&assetid=0EB8E7F82A0D4A76A4AF9A72993FED5B&field_values=[["255F307E-AE5A-4E66-AD2F6BBE81D0541C","val1"],["7FD45BCC-F3ED-4C85-8CCCF50CDCE98E8E","val2"]]

Sample Output

{["responsecode":"0","message":"Custom field values successfully added"]}