API: update dependency_parent_hostname doesn't work

Hi,

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 
 'X-Auth-Token:MY_TOKEN' 
 'https://MY_SERVER_URL/api/v0/devices/HOSTNAME_RECIEVING_THE_PARENT'
{
    "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:
https://p.libren.ms/view/fe6245cd

EDIT:
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 
('$parent_uid_lnms','$host_uid_lmns')

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?

Update:

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:
https://p.libren.ms/view/4c33d8ce

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