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

Unable to retrieve subelement rack via API #17260

Closed
2 tasks done
BDEN-sys opened this issue Jun 5, 2024 · 2 comments
Closed
2 tasks done

Unable to retrieve subelement rack via API #17260

BDEN-sys opened this issue Jun 5, 2024 · 2 comments
Assignees
Labels

Comments

@BDEN-sys
Copy link

BDEN-sys commented Jun 5, 2024

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

10.0.15

Bug description

Hello,

I am trying to export enclosures inside a rack with API
https://URLGLPI/apirest.php/rack/15/Enclosure

This URL retrieve all enclosures instead of those inside the rack with id 15.

I check the sql logs and there is no clause with id 15 :

SELECT DISTINCT `glpi_enclosures`.`id`,  `glpi_enclosures`.*
                FROM `glpi_enclosures`
               WHERE 1=1 AND `glpi_enclosures`.`is_deleted` = 0 AND ( ( `glpi_enclosures`.`entities_id` IN ('23','51','24','25')  OR (`glpi_enclosures`.`is_recursive`='1' AND `glpi_enclosures`.`entities_id` IN (0, 60, 38)) ) )
                ORDER BY `id` ASC
                LIMIT 0, 30

Test with dcrooms to compare SQL : /dcroom/1/rack/

https://URLGLPI/apirest.php/dcroom/1/rack/


SELECT DISTINCT `glpi_racks`.`id`,  `glpi_racks`.*
                FROM `glpi_racks`
                WHERE 1=1 AND `glpi_racks`.`is_deleted` = 0 AND `glpi_racks`.`dcrooms_id` = 1 AND ( ( `glpi_racks`.`entities_id` IN ('23','51','24','25')  OR (`glpi_racks`.`is_recursive`='1' AND `glpi_racks`.`entities_id` IN (0, 60, 38)) ) )
                ORDER BY `id` ASC
                LIMIT 0, 30

In this SQL query, there is a clause to limit racks inside the dcroom with id 1 : dcrooms_id` = 1

Regards

Relevant log output

No response

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

No response

Anything else?

No response

@cconard96
Copy link
Contributor

Not a bug; just a quirk of the legacy API.

Racks have a field for the DC room they are in, so the URL you used works.
Enclosures aren't directly related to racks in the same way. Instead, there is an Item_Rack item that represents the link between a rack and an item, such as an enclosure, that exists inside the rack.

/apirest.php/Rack/15/Item_Rack should give you all of the items in the rack.

@cconard96 cconard96 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
@cconard96 cconard96 self-assigned this Jun 13, 2024
Copy link
Contributor

This issue has been closed as we only track bugs here.

You can get community support on forums or you can consider taking a subscription to get professional support.
You can also contact GLPI editor team directly.

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

No branches or pull requests

2 participants