I have created the API
the api work find if I hit the URL directly mysite/api/webhookas in the webhook the thirdparty is passing the data through POST
so just try a simple form to pass data through POST
when I click the submit button the page redirect to mysite/api/webhook with an error as
This page isn’t working
If the problem continues, contact the site owner.
HTTP ERROR 401I recheck the url and url correct and working if hit directly in the browser.
I have upgraded to PHPMaker v2024.3Here I am trying to get my webhook at “mysite/api/webhook”
I got the same errorThis page isn’t working
If the problem continues, contact the site owner.
HTTP ERROR 401but If I hit the api directly from the browser it is working
If you use Custom File, the URL is not “mysite/api/webhook”, it should be the route of your Custom File, read Custom Files → Path → Case 1.If you use API, you need to send the JWT token, read Authenticate User with JWT (JSON Web Token).If you don’t want/need to protect your action with JWT token, you may use Route_Action server event instead.
As I am trying to create a webhook it won’t be possible to sent the JWT token
You should be able to. How did you send the request? You may check if it supports --header. Post the code that you use to send the request.thomas wrote:
I have try with the function Route_Action($app){ } also which form a url “mysite/webhook” but it is not working.
You need to describe how it is “not working”, any error messages? Always post your code for discussion. Make sure your URL to your route action is correct.
You should enable Debug and check errors in the log file.
In the Form I use the action url as http://mysite/webhookhere I got the error as
404
Not Found
Route ‘webhook’ not found.when I put the same url http://mysite/webhook
in the browser address bar it is workingHere I am confuse the same url working in browser address bar and not working on form action url.when I debug the code I got the error log as -
Post the Request URL you see in your browser, compare it with the URL you defined in your Route_Action event.Be also reminded that if you have enabled Use route cache:
When you deploy new versions of your scripts (for example, after adding or deleting a table) to production, you must delete the generated file (//cache/RouteCache.php) to ensure that the cache will be re-compiled.
The GET method works perfectly.But as I want to accept my webhook for POST data I just change the GET to POSTI did not change the url which is working on GET
When I sent data through POST I got an error as
{“statusCode”:404,“error”:{“class”:“text-warning”,“type”:“Not Found”,“description”:“Route ‘webhook’ not found.”,“trace”:"#0 C:\wamp\www\mysite\vendor\slim\slim\Slim\Handlers\Strategies\RequestResponse.php(38): Closure->PHPMaker2024\Mysite2024\{closure}(Object(Slim\Http\ServerRequest), Object(Slim\Http\Response), Array)…Please kindly help.
Thanks in Advance.