Skip to main content

Hello,
since we last upgrade from 20.10 to 22.04 we have a couple of perl script that fail. It seems as if the URL for the API changed and the authentication token could no be retreive.

This is the request in the script, which worked before the upgrade:


my $resauth = $ua->request(POST "https://${hostname}/centreon/api/index.php?action=authenticate", username => "$username", password => "$password"]);

 

And the error is:


malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<!DOCTYPE HTML PUBLI...") at /opt/clapi/ExportCentreonServices.pl line 75.
 

What can be wrong?

Regards,

Enrique

Also, using curl for that URL gives 404 Not Found error.


đź‘‹

curl

curl "https://x.x.x.x/centreon/api/index.php?action=authenticate" -F "username=\"aaaaa\"" -F "password=\"xxxx\""

or

 


Hello ponchoh

 

using curl with the username and password options as you pointed again gives 404 Not Found error.

 

Using the second method on Firefox gives "Unauthorized"


I did run it in 22.04 anything in the logs?


Hello,

sorry for the late reply.

The script is working again but using http:// instead of https:// to authenticate. Since the script runs in the locally in the central server it is ok for us now.

 

We still don’t know what was broken during the upgrade.

 

Regards,

Enrique


Reply