Centreon API v21.10 .net core

  • 23 September 2022
  • 2 replies

Badge +1


I’m using Centreon Api v2 for an application .net Core C#, i have a probleme when use async method like Get Host or AcknowledgementsPOST4Async for service and i get response : Internal server error 500.

the login method works good.

the code :

var task = Task.Run(async () => await CentreonApi.LoginAsync(authenticationRequest,cancellationToken));
                    var resultAsync = task.Result;
                    var task1 = Task.Run(async () =>
                    await CentreonApi.Hosts2Async(177, cancellationToken);
                    var resultAsync1 = task1.Result;
                  var taskAcknowledgement = Task.Run(async() =>  CentreonApi.AcknowledgementsPOST4Async(177, 1193, CommentNotif));
                    var resultAsync1 =  taskAcknowledgement.Result;

i miss somthing in my code ?

2 replies

Userlevel 2
Badge +2

Hello @Mahdi 


Do you have any error message with your 500 ? Even on your Result object ?

Or have you some errors into the php logs in /var/log/php-fpm/centreon-error.log ? 

Badge +1

Hello Jérémy Jaouen,

I checked the log file “Token was not found”.


How can i use the token in Centreon Api methods in c# ?