Skip to content

Python API

Dariusz Jarosz edited this page Feb 27, 2025 · 1 revision

Getting the API

The API can be found on Pypi

Special Cases

Updating property value using the Date handler.

Property values with a date handler have the date stored in a specific format. Below you will find details how this can be set from API.

# Updating a property value with Date handler
factory = CdbApiFactory('https://cdb-url')
 
STRING_FORMAT = "%a %b %d 00:00:00 CDT %Y"
item_api = factory.getItemApi()
property_api = factory.getPropertyValueApi()
now = datetime.datetime.now()
 
property_date_str = now.strftime(STRING_FORMAT)
property = property_api.get_property_value(property_value_id)
property.value = property_date_str
 
item_api.update_item_property_value(item_id, property_value=property)
Clone this wiki locally