Modify a resource property: Standard values
To assign a value to a property, all you have to do is indicate this value for the property. For example, to assign the name "Aerial view of Canareef Resort Maldives, Herathera Island, Addu Atoll" in the description property:
{
"description": "Aerial view of Canareef Resort Maldives, Herathera Island, Addu Atoll"
}
Type conversion
It is better to indicate the value in its own type. If the type does not conform, we will try to convert it when possible. Some conversions can give unexpected results, especially the conversion of strings to numbers (format problems).
In general, the values are as hybrid as possible. This means that the same value can be assigned, when possible, to properties of different types.
For example, we can assign an array of identifiers (used to assign the value of a multiple link property) to a single link property: the first identifier of the array will then be assigned.
Identifiers (type link to a resource)
Identifiers can be assigned (for properties of type link to another resource) either as a number or as a string. A unique identifier cannot be assigned directly to a property, and the assigned identifier must correspond to an existing resource.
We can also pass a JSON object, with a single id
property (whose value will be that of the identifier to be assigned), or possibly, an additional $mode
property (normally used only for multiple link type properties, see the hybrid aspect of values above).
The examples below characterize the same assignment:
{
"coverage": 42
}
{
"coverage": "42"
}
It is only possible to modify a workflow(status) property if it has been configured to be modified directly by its identifier. This is only to support the old workflow mode: normally, you have to use the specific service that uses a transition action system to modify the workflow of an object. See Workflows (change status, or get possible workflow actions) for more details.
Booleans (type link to activated)
To assign a value to a boolean property, you just have to indicate a boolean value. For example:
The value can also be passed as a string (case insensitive):
“true” for true
"on" is also accepted, to facilitate checkbox processing in an html form.“false” for false
It can also be assigned a number, either as a number or as a string:
1 (or “1”) for true
2 (or “2”) for false
Integers
To assign a value to a integer property, you just have to indicate a integer value. For example:
The value can be passed as a string, as an optional sign (- or +) followed with decimal digits.
Decimals
To assign a value to a integer property, you just have to indicate a integer value. For example:
The value can be passed also as a string.
Dates
To assign a value to a date property, you just have to indicate a long value, as UTC millisecond timestamp. For example, to set the date 22/02/2022:
The value can be passed as a string in one of the following formats:
ISO_DATE (yyyyMMdd)
ISO_DATE_JS (yyyy-MM-dd)
Date and times
To assign a value to a datetime property, you just have to indicate a long value, as UTC millisecond timestamp. For example, to set the date and time 22/02/2022 22H02:
The value can be passed as a string in one of the following formats:
ISO_DATE_TIME (yyyyMMdd'T'HHmmss)
ISO_DATE_TIME_JS (yyyy-MM-dd'T'HH:mm:ss)
Standard strings
To assign a value to a string property, you just have to indicate the string value. For example:
HTML
HTML properties are managed as string properties.
JSON
JSON properties are managed as strings. But it is possible to configure them so that we can directly pass JSON (an object or an array only). See details here.