Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API - Can't update port notes #15762

Open
dblviking opened this issue Jan 17, 2024 · 1 comment · Fixed by #15766
Open

API - Can't update port notes #15762

dblviking opened this issue Jan 17, 2024 · 1 comment · Fixed by #15766
Labels

Comments

@dblviking
Copy link

dblviking commented Jan 17, 2024

The problem

I can't update the port notes. I keep getting :

Cannot access offset of type string on string {"userId":1,"exception":"[object] (TypeError(code: 0): Cannot access offset of type string on string at /opt/librenms/includes/common.php:294)"}

curl -svk -X PATCH -H "X-Auth-Token: " -H "Content-Type: application/json" -d '{"notes": "test"}' https://librenms-server/api/v0/devices/63/port/3953

I've tried different variations too. I even used the example in the notes:
https://docs.librenms.org/API/Devices/#update_device_port_notes
but it still fails. When I change the device_id to a hostname (from select hostname from devices;), I get:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'device_id' cannot be null (Connection: mysql, SQL: insert into `devices_attribs` (`attrib_type`, `attrib_value`, `device_id`) values (port_id_notes:2, test, ?)) {"userId":1,"exception":"[object] (Illuminate\\Database\\QueryException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'device_id' cannot be null (Connection: mysql, SQL: insert into `devices_attribs` (`attrib_type`, `attrib_value`, `device_id`) values (port_id_notes:2, test, ?)) at /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php:822)
[previous exception] [object] (PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'device_id' cannot be null at /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php:580)"}

I just want to update the port notes via the api,so it shows up ie)
/device/device=63/tab=port/port=3953/view=notes/

Any advice?

Output of ./validate.php

./validate.php
===========================================
Component | Version
--------- | -------
LibreNMS  | 24.1.0-39-gf9fc80966 (2024-01-17T16:58:08-05:00)
DB Schema | 2023_12_12_171400_alert_rule_note (277)
PHP       | 8.1.2-1ubuntu2.14
Python    | 3.10.12
Database  | MariaDB 10.6.12-MariaDB-0ubuntu0.22.04.1
RRDTool   | 1.7.2
SNMP      | 5.9.1
===========================================

[OK]    Composer Version: 2.6.6
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database Schema is current
[OK]    SQL Server meets minimum requirements
[OK]    lower_case_table_names is enabled
[OK]    MySQL engine is optimal
[OK]    Database and column collations are correct
[OK]    Database schema correct
[OK]    MySQL and PHP time match
[OK]    Active pollers found
[OK]    Dispatcher Service not detected
[OK]    Locks are functional
[OK]    Python poller wrapper is polling
[OK]    Redis is unavailable
[OK]    rrd_dir is writable
[OK]    rrdtool version ok

What was the last working version of LibreNMS?

No response

Anything in the logs that might be useful for us?

No response

@PipoCanaja PipoCanaja changed the title Can't update port notes API - Can't update port notes Jan 18, 2024
@PipoCanaja PipoCanaja added the API label Jan 18, 2024
rudybroersma added a commit to rudybroersma/librenms that referenced this issue Jan 19, 2024
@PipoCanaja
Copy link
Contributor

fixed in #15766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants