Is it possible to make a general change in any evolution on API function ?
I mean when you decide to add a parameters, is it possible to:
1: add it at the end of the call
2: make it with a default value
So during migration at least current product are still able to work, and that let some time to adapt to the new definition ?
I'm using api_tree_item_save, and you decide to add the site_id in the middle of the call, an I don't think it's very good to act like that, since the CHANGELOG dosen't reflect that change:
1.2.0 Beta 1
-feature: Allow threads to be set a Data Collector level
-feature: Support Cacti 1.2's new data collection method
-feature: Escape strings more rubustly
-issue#50: make in Debian 7: undefined reference to `clock_gettime'
-issue#53: Variables are not being escaped properly when updating database
-issue#54: Spine should always report if ICMP fails
-issue#58: Error on poller.c: escaping string from snmp_sysLocation
-issue#63: Adjust Device Threads if a Device has fewer Data Sources
-issue: Align SQL_MODE's in spine with Cacti's database api
Change in API
Moderators: Developers, Moderators
Change in API
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Re: Change in API
Working backwards:Now
function api_device_save($id, $host_template_id, $description, $hostname, $snmp_community, $snmp_version,
$snmp_username, $snmp_password, $snmp_port, $snmp_timeout, $disabled,
$availability_method, $ping_method, $ping_port, $ping_timeout, $ping_retries,
$notes, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_engine_id,
$max_oids = 5, $device_threads = 1, $poller_id = 1, $site_id = 1, $external_id = '', $location = '') {
Location was added in commit f6510d680585e6b4461c1f2f3116bb436beb9bc0
External ID was added in commit 2e33bc95b29ec52032fa78f7bff024cd99239a6d
Site ID and Poller ID were changed from a ZERO default ot ONE in commit 8f304f744cdf67c3f08236f4f0e5d7178ab425bf
SNMP Engine ID was added in the middle in commit 76d75b0de33f790a27b33190c3785ecc939d57e5 (it's a required field)
Site ID and Poller ID were added in 247228c84e9790fce4415734559761bbb3eeed4a
These are all v1.2 changes as far as I can tell and all follow the practice you are describing with the exception of snmp_engine_id which unusually was added in the middle and does NOT have a default. That is irregular in terms of an API function but as with any API that could happen as it's a different version. If you are using this function from your own plugin, you can use the CACTI_VERSION constant to compare and see if that field would be required.
As the documentation is slowly being updated, that will also highlight potential API function call issues but we are not there yet.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: Change in API
Hello,
Thanks,
But I'm talking about api_tree_item_save and can't find anything on when it change.
Thanks,
But I'm talking about api_tree_item_save and can't find anything on when it change.
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Re: Change in API
Sorry, my bad, let me go check.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: Change in API
So that appears to be changed in commit 2c4b143c which was over a year ago in relation to:
https://github.com/cacti/cacti/issues/122
https://github.com/cacti/cacti/issues/122
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: Change in API
Ok
was not on release 1.1.38
was not on release 1.1.38
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Re: Change in API
That's interesting, as I don't recall changing that in one of Howie's plugins that does tree manipulation. I'll have to have a look.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Who is online
Users browsing this forum: No registered users and 2 guests