Menu

iTop trigger doesn't work when using API

Marah Alh
2023-08-17
2023-08-27
  • Marah Alh

    Marah Alh - 2023-08-17

    Hello dears,

    I need to update the Request status to "closed" using iTop API, and I created a
    Trigger (on entering a state) with state: closed, but unfortunately the trigger doesn't work.

    I note that the trigger work only when the user take the action from iTop.
    How can I solve this problem, please?

    I use c#

    var client = new RestClient("http://"+iTopOptions.Host);
    client.Authenticator=new HttpBasicAuthenticator(iTopOptions.User,iTopOptions.Password);
     var request = new RestRequest($"webservices/rest.php?version=1.0&json_data=" +
                                              $"{JsonConvert.SerializeObject(UpdateObj)}", Method.POST);
    
    request.RequestFormat = DataFormat.None;
     var resp = client.Execute(request);
    Console.WriteLine("request has been updated");
    
     
  • Guillaume Lajarige

    Hello Marah,

    Can you share a screenshot of the trigger? Have you set a "context" on it?

    Guillaume

     
    • Marah Alh

      Marah Alh - 2023-08-17

      Hello Guillaume,

      iTop version 2.6.1 doesn't have this attribute.
      But I noticed that version 3.0 has this attribute, so I will upgrade to version 3.0.

      thanks a lot.

       
  • Guillaume Lajarige

    You don't need to upgrade to 3.0, I was only asking to see if you had put something in it which would have explain the issue.

    Could you share a screenshot of the trigger anyway?

     
    👍
    1
  • Marah Alh

    Marah Alh - 2023-08-17

    Dear Guillaume,

    kindly find the attached photos.

    Even when I set "context" to "REST" and "console", the trigger doesn't work :(

     
  • Guillaume Lajarige

    Oh, I found noticed something. Through the REST API, do you set the status value or do you use the "apply_stimulus" operation?

    If you set the status value, it's normal that the trigger isn't activated because it doesn't consider that it has entered a state.
    You should rather make a second REST call with the "apply_stimulus" operation.

     
    • Marah Alh

      Marah Alh - 2023-08-23

      Thank you Guillaume,

      we make another REST call with the "apply_stimulus" operation and the trigger work.

      I appreciate your consistent help .

       
    • Guillaume Lajarige

      Glad to see you fixed it :)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.