Page 1 of 2

REST API Plugin v7.2.1.32 is not working properly

PostPosted: Fri Jan 20, 2023 7:05 am
by sameermoin
Hi Everyone,


I am using REST API Plugin v7.2.1.32 with the default webhook event. The problem I am facing is it's not sending messages to the webhook subscriber, it is just queuing the messages with status 0, but when I restart the REST API service it pushes all the messages but again when a new message is triggered it starts queueing the message, so for every message I need to restart REST API service.

I tried this version on two different Jiwa instances and both caused the same issue.

The same configuration with the v7.2.1.27 is working fine, as I am using some custom webhook events, it requires some modification to use the Webhook method on the different plugins.

On version 27 I am getting "The 'Content-Type' header must be modified using the appropriate property or method. Parameter name: name"

Here are my Configurations:

rest api plugin.jpg


I also attached the v32 plugin

Re: REST API Plugin v7.2.1.32 is not working properly

PostPosted: Fri Jan 20, 2023 10:36 am
by SBarnes
By the sounds of it your problem may possibly be that calls to the api are not reaching the api and fall back code in the business logic is adding the entries to the message table.

You could probably check this using postman or by putting a System.Diagnostics.Debugger.Launch call in the appropriate place in the rest api plugin so you can see what is happening, or alternately turn on debug mode and have a look at the request logs created and see if hook post calls are getting there.

Re: REST API Plugin v7.2.1.32 is not working properly

PostPosted: Fri Jan 20, 2023 11:03 am
by Mike.Sheen
Also putting localhost in your webhooks host url limits webhooks to only work when originating from the same machine as the REST API.

Is your REST API Running on port 8090? What's the .exe.config file look like?

Re: REST API Plugin v7.2.1.32 is not working properly

PostPosted: Fri Jan 20, 2023 4:29 pm
by sameermoin
The screenshot I attached is from my local machine. Everything is the same except the WebhooksHostURL. On the other machines, it contains HTTPS custom domain URLs.

The latest version is also working but only when I restart the service again and again. The configuration seems good because its works with the older versions. The problem is occurring only on version 32

I tried on both the self-hosted API service method and the IIS method.

Here are the API config file settings. I just renamed the values.

Code: Select all
<appSettings>
    <add key="ServerName" value="ABC.CLOUD\SQL,1433" />
    <add key="JiwaUsername" value="JiwaAPI" />
    <add key="DatabaseName" value="JiwaDemo" />
    <add key="JiwaPassword" value="8M23G924" />
    <add key="URLBase" value="https://abc.com" />
    <add key="ClientSettingsProvider.ServiceUri" value="" />
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
</appSettings>

Re: REST API Plugin v7.2.1.32 is not working properly

PostPosted: Fri Jan 20, 2023 4:35 pm
by Mike.Sheen
sameermoin wrote:The latest version is also working but only when I restart the service again and again


This tells me that the REST API is not reachable on the URL configured in the WebHooksHostURL in the system settings.

Clients will try to POST to that URL, and if it fails they fall back to a SQL insert to the table SY_WebHookMessage. When the service starts, this table is read and pending webhooks are then attempted to be sent.

Your clients are failing to POST to the WebHooksHostURL.

Try using Postman or similar a POST to /Webhooks/Events/ - what response do you get back? Make sure to use the URL in your WebHooksHostURL system setting.

Re: REST API Plugin v7.2.1.32 is not working properly

PostPosted: Fri Jan 20, 2023 4:37 pm
by SBarnes
Turn on the debug system setting on the rest api plugin itself, restart the api and have a look at the request logs once you you have changed something that should cause a hook to fire.

If there is nothing in the request logs for it then something in the environment is blocking it like a firewall.

Likewise you can try using postman to send data to the route.

Unfortunately we won't be able to diagnose what is going on in your environment from settings alone.

Re: REST API Plugin v7.2.1.32 is not working properly

PostPosted: Fri Jan 20, 2023 4:42 pm
by sameermoin
Mike.Sheen wrote:Try using Postman or similar a POST to /Webhooks/Events/ - what response do you get back? Make sure to use the URL in your WebHooksHostURL system setting.



This route returns a list of webhook events.
postman.jpg

Re: REST API Plugin v7.2.1.32 is not working properly

PostPosted: Fri Jan 20, 2023 4:44 pm
by SBarnes
Post not get send to it data like the business logic does.

Re: REST API Plugin v7.2.1.32 is not working properly

PostPosted: Fri Jan 20, 2023 4:46 pm
by Mike.Sheen
sameermoin wrote:This route returns a list of webhook events.


No kidding.

Now read what I posted.

Re: REST API Plugin v7.2.1.32 is not working properly

PostPosted: Fri Jan 20, 2023 5:12 pm
by Mike.Sheen
I've updated our docs page with a diagram which may make this clearer.

untitled_page.png

The WebHooksHostURL system setting should be a valid URL accessible by all Jiwa clients. If this URL is not reachable, webhooks will not be sent to subscribers until the REST API service is restarted.