API - Planyo Web Services - add_custom_property_definition

Jesteś tutaj: Planyo » Pomoc » API » add_custom_property_definition

add_custom_property_definition

Description:

Adds a new custom property definition to your site or metasite. This will show the new property in resource settings / general info in the backend UI (for resource properties), or in site settings / company info (for site properties). Custom property definitions are required if you need them as search criteria or resource listing filters. If the resource property (or any of the aliases) already exists, it will not be overridden.

Input:

name string required
Custom property name
type string optional
Property type. One of: 'text', 'dropdown', 'checkbox', 'textarea', 'multiple_checkboxes', 'gps', 'persons', 'url', 'tax_rate'. These correspond to the property types found in the backend UI. Default value is 'text'.
possible_values string optional
In case of the 'dropdown' type, you must enter comma-separated possible values.
search_condition string optional
Leave this empty unless you want the property to be used as a search criterium. In such case enter one of the following: 'eq': search finds only the exact value, 'gte': for numeric values it's the >= operator, 'gt': numeric >, 'lte': numeric <=, 'lt': numeric <, 'mv_': in search presented as multiple checkboxes (at least one must match), 'm2_': in search presented as multiple checkboxes (all must match), 'cnt': (for text values) value must contain text specified in search box, 'chk': must be chosen if type is 'checkbox' unless you don't need this as a search criterium.
scope string optional
One of 'resource', 'site'. Default is 'resource'. This determines whether the custom property definition is for resource properties or site properties. The value 'site' is used only by metasites.
comment string optional
Optionally you can add a comment which will be visible when setting the value of this custom property for a resource.
icon string optional
Optionally you can set one of the supported icon identifiers (e.g. mdi-xxx).
default_visibility int optional
Optionally you can set the default visibility in resource details and listings templates: 0 = none, 1 = resource details page, 3 = resource details and listing pages.
aliases string optional
You can pass a comma-separated string of aliases. If an existing property definition with the alias name exists, the custom property will not be added.
method string required
must be set to add_custom_property_definition
language string optional
by specifying a 2-letter (ISO 639-1) language code (all capital letters e.g. EN, DE, FR, ES, IT) you can change the language of the text values returned
api_key string required
your API key - Click here to get your key. If your API key uses a hash key, you must also include the parameters hash_key and hash_timestamp.

Output:

none

API playground:

Click here to test this function in the API playground.