The API update_device_field route doesn't exist?

Hi…

Using the update_device_field API command, LibreNms return a “This API route doesn’t exist” error message.

First I successfully create a new device, getting device id from output :

/usr/bin/curl -X POST --insecure -d '{"hostname": "IP", "display": "DISPLAY", "poller_group": 10, "community": "COMMUNITY"}' -H 'X-Auth-Token: TOKEN' https://URL/api/v0/devices
{'status': 'ok', 'devices': [{'hostname': 'IP', 'display': 'DISPLAY', 'poller_group': 10, 'community': 'COMMUNITY', ...... 'device_id': 325}], 'message': 'Device IP (325) has been added successfully', 'count': 1}

Then I try to update the device, and get the “This API route doesn’t exist.” error message :

/usr/bin/curl -X POST --insecure -d '{"field": "notes", "data": "TEST"}' -H 'X-Auth-Token: TOKEN' https://URL/api/v0/devices/325
{'status': 'error', 'message': "This API route doesn't exist."}

Strictly following the API documentation I don’t get what is wrong.
How to make the update works fine ?

Note : I tried to replace the device id by its hostname (which is an IP address) in the update route, and result is the same.

Output of validate.php :

Component Version
LibreNMS 23.8.0 (2023-08-29T15:24:06+02:00)
DB Schema 2023_06_18_201914_migrate_level_to_roles (257)
PHP 8.1.22
Python 3.7.3
Database MariaDB 10.3.39-MariaDB-0+deb10u1
RRDTool 1.7.1
SNMP 5.7.3

Ho my gosh…
I didn’t notice that curl POST -X parameter is replaced by PATCH…

/usr/bin/curl -X POST ...
/usr/bin/curl -X PATCH ...

And it works fine with PATCH now.

Have to better RTFM…
Maybe this will help another distracted reader in future… :upside_down_face:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.