API: update dependency_parent_hostname doesn't work

Tags: #<Tag:0x00007f84a75558b0> #<Tag:0x00007f84a75557e8> #<Tag:0x00007f84a7555720>


I try to update the host dependencies by API.

curl --cacert /etc/apache2/ssl.crt/ca.crt -sS -X PATCH -d '{"field":
 "dependency_parent_hostname","data":"PARENT_HOSTNAME"}' -H 
    "status": "ok",
    "message": "Device dependency_parent_hostname field has been updated"

When I look into the host object, nothing hast changed.

What’s wrong?

The validate.php - Output:

I just found out

  1. even if You use non-existing fieldnames in the { }-construct, You always get the status “ok” and the message “Device DIRDARIQUATSCH field has been updates”
  2. parent-child dependencies are kept in a separate table;

So I guess:

  • the API is broken when it comes to updating fields
  • I would have to update that separate tabel

Is there a way to do that with an API call?

For the time beeing, I switched over to MySQL statements

INSERT INTO device_relationships (parent_device_id,child_device_id) VALUES 

This works, but for me in our uninversities situation the preferred way is through the API. Any chance, anyone of You knows the right path to the right api endpoint?


I just tried the API path for adding parents to a host and it doesn’t work:

curl --cacert <PATHTOMYCERTS> --X POST -d '{"parent_ids":"2107"}' -H 'X-Auth-Token: <MYTOKEN>' https://<LIBRENMS:PORT>/api/v0/devices/1/parents

… and the bash just ‘hangs’: no logentry, no error, nothing.

Am I doing sth. wrong?

The validate.php - Output: