REST invoker web service synchronization by ticket state

Moderator: crythias

Post Reply
BuilderNSV
Znuny newbie
Posts: 3
Joined: 18 Sep 2025, 07:36
Znuny Version: 7.2.1
Real Name: Sergey

REST invoker web service synchronization by ticket state

Post by BuilderNSV »

Hi everyone,

I need to have REST invoker web service which send data to outer system on TicketStateUpdate event but should not update ticket state if web service fails to send data.

I tried with Ticket::Generic backend and synchronous event trigger for TicketStateUpdate but ticket has changed its state successfully and web service has not sent required data.

Is it possible to make it just only by configuration or I need to correct code somewhere?
root
Administrator
Posts: 4273
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: REST invoker web service synchronization by ticket state

Post by root »

Hi,

Did the outgoing data match the format the receiving site expected? What does the web service log say?

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
BuilderNSV
Znuny newbie
Posts: 3
Joined: 18 Sep 2025, 07:36
Znuny Version: 7.2.1
Real Name: Sergey

Re: REST invoker web service synchronization by ticket state

Post by BuilderNSV »

Hi Roy,

I've added attachment -
RestInvoker.yml
configured by me.
I expressly changed the Endpoint in network transport properties to simulate the absence of a server and get error on sending data.

I get what I was expected to see. There is a part of commucation log:
JSON data received from remote system (09/20/2025 00:03:16 (Asia/Vladivostok), debug)

Can't connect to zzz.yyy:80 (Name or service not known)
Name or service not known at /opt/znuny/Kernel/cpan-lib/LWP/Protocol/http.pm line 50.

Error while performing REST 'POST' request to Controller '/Ticket' on Host 'http://zzz.yyy/znuny/nph-genericinterfa ... y_provider'. Response code '500'. (09/20/2025 00:03:16 (Asia/Vladivostok), error)

Response content: 'Can't connect to zzz.yyy:80 (Name or service not known)
Name or service not known at /opt/znuny/Kernel/cpan-lib/LWP/Protocol/http.pm line 50.
'
You do not have the required permissions to view the files attached to this post.
root
Administrator
Posts: 4273
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: REST invoker web service synchronization by ticket state

Post by root »

Hi,

And the receiving system is also a Znuny that handles this with the endpoint /Ticket, the following payload?

Code: Select all

{
    "fields":
    {
        "TicketID": "1223",
        "TicketNumber": "202509191092829",
        "StateID": 1,
        "State": "new"
    }
}
I guess the target system can't handle the payload with it's mapping.

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
BuilderNSV
Znuny newbie
Posts: 3
Joined: 18 Sep 2025, 07:36
Znuny Version: 7.2.1
Real Name: Sergey

Re: REST invoker web service synchronization by ticket state

Post by BuilderNSV »

No, if endpoint server is specified correctly request is sent successfully (I use Test::Test controler for provider).

I simulated a situation where the destination server is unavailable and web request had been failed with error 500.
In case of error I still get changed state of ticket but I want to rollback this action (change of state) - is it possible to realize in Znuny?
Post Reply