Error 405 when querying API

280 views
Skip to first unread message

ramsalado

unread,
Aug 10, 2023, 6:34:58 AM8/10/23
to Wazuh mailing list
Hello, I have searched before writing, but I can't find a solution, sorry if the topic is answered.

I have an instance of Wazuh on a client, version 4.3. I would like to start working with the API to make some queries.

I have configured the file /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml
hosts:
  - default:
        url: https://localhost
        port: 55000
        username: wazuh-wui
        password: wazuh-wui
        run_as: false

Also the file /var/ossec/api/configuration/api.yaml with the default configuration from the documentation (for 4.3)

When I make a request from the server itself
[root @ 11siem]# curl -u wazuh-wui:wazuh-wui -k -X POST "https://localhost/security/user/authenticate"
The answer is: "{"statusCode":404,"error":"Not Found","message":"Not Found"}"

I have not had this error in other instances, I have tried disabling the firewall and the response is the same. I have tried regenerating the ssl certificates and the response is the same.

Can anyone give me a clue.

Thanks!

ramsalado

unread,
Aug 10, 2023, 6:42:57 AM8/10/23
to Wazuh mailing list
Other answer
[root @ 11siem]# curl -u wazuh-wui:wazuh-wui -k -X POST "https://localhost:55000/security/user/authenticate"
{"title": "Method Not Allowed", "detail": "405: Method Not Allowed"}

Daniel Folch

unread,
Aug 10, 2023, 9:31:04 AM8/10/23
to Wazuh mailing list

Hello,

I guess you are trying to connect to the Wazuh manager API, check this page of the documentation where we explain how to do it:
https://documentation.wazuh.com/current/user-manual/api/getting-started.html
And here you have the documentation reference about all the different calls allowed by the API:
https://documentation.wazuh.com/current/user-manual/api/reference.html

Note that the username and password indicated in /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml are the credentials that will be used by the Wazuh dashboard to communicate with the Wazuh manager API changing the password there will not change the password in the API if you want to modify the credentials of the Wazuh manager API check this:
https://documentation.wazuh.com/current/user-manual/api/securing-api.html
Remember that if you change the credentials for the user wazuh-wui you need to reflect the changes in /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml to avoid errors in Wazuh dashboard.

Reply all
Reply to author
Forward
0 new messages