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

[BUG] REST API not working as it should #1575

Closed
pchamorro2005 opened this issue Dec 7, 2023 · 3 comments
Closed

[BUG] REST API not working as it should #1575

pchamorro2005 opened this issue Dec 7, 2023 · 3 comments

Comments

@pchamorro2005
Copy link

OCS Inventory version
Version : 2.12

Describe the bug
Some pages of REST API do work.
Some pages give we're sorry something went wrong
Some pages give raptor not found

To Reproduce
If I open https://ocs.sgc.gov.co/ocsapi/v1/my/routes it gives:
raptor not found

If I open https://ocs.sgc.gov.co/ocsapi/v1/computers/listID, it works but if I open https://ocs.sgc.gov.co/ocsapi/v1/computers?start=0&limit=10 it gives:

we're sorry something went wrong

Apache log shows:

DBD::mysql::db selectall_arrayref failed: Table 'ocsweb.eventlogs' doesn't exist at /usr/lib64/perl5/vendor_perl/Api/Ocsinventory/Restapi/ApiCommon.pm line 226.
[Thu Dec  7 12:03:59 2023] [error] DBD::mysql::db selectall_arrayref failed: Table 'ocsweb.eventlogs' doesn't exist at /usr/lib64/perl5/vendor_perl/Api/Ocsinventory/Restapi/ApiCommon.pm line 226.

So, I created table eventlogs and added HARDWARE_ID column, and it worked!

But /ocsapi/v1/my/routes gives raptor not found. So there are two bugs, one for eventlogs table not created and one for my/routes not found.

Software and snmp queries, work.

Thank you

@gillesdubois
Copy link
Member

Hi,

If I open https://ocs.sgc.gov.co/ocsapi/v1/my/routes it gives: raptor not found

ocsapi/v1/my/routes is a placeholder and need to be changed with the route you actually want to use.

Concerning the second error with eventlogs, it seems you have a plugin installed / declared in the perl engine but the mysql table is not present.

You have two options :

  • Install the plugin properly according to the documentation
  • Remove plugin declaration in the perl engine (/etc/ocsinventory-server by default)

Regards,
Gilles DUBOIS.

@pchamorro2005
Copy link
Author

pchamorro2005 commented Dec 11, 2023

Thank you very much for the answer. About myocsserver/ocsapi/v1/my/routes, it would be good clarify in the documentation about that because I wasn't the only one who thougth that myocsserver/ocsapi/v1/my/routes should show the list of variables available to query through that API.

@gillesdubois
Copy link
Member

Hello,

Thanks for your feedback.
I'll update the documentation to make sure it doesn't mislead other people :)

Regards,
Gilles DUBOIS.

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

No branches or pull requests

5 participants