Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


thomasaull last won the day on September 19 2018

thomasaull had the most liked content!

Community Reputation

99 Excellent

About thomasaull

  • Rank
    Full Member

Contact Methods

  • Website URL

Profile Information

  • Location
    Würzburg, Germany

Recent Profile Visitors

1,528 profile views
  1. Recently a user of this module had the problem that some multi-language fields weren't working correctly.kno After some investigation I discovered, that the hook this module uses (it's a "before ProcessPageView::execute") kicks in to early for the multi-language plugins to be ready. Does anyone knows of a hook, which can do something similar (basically take over the default routing of ProcessWire) while still have the other modules loaded? One alternative approach for this specific problem would be to not trigger the module via a hook but with an own template and page like the old RestApiProfile did. A couple of benefits would come for free aswell (these are my assumptions, not tested yet): ProCache should work without any workarounds Multi-Language works Websites in subdirectories (if working in ProcessWire in general) should work site profile export would work if the /api folder lives in /templates by default Any potential downsides I'm not seeing yet? Thoughts?
  2. @dragan Can you please check your php error log too?
  3. @thibaultvdb I need to check this, since I think (when I remember it properly) I put this option in specifically for this use-case. If you want to fiddle around try making it work or you know/want to figure out how ProcessWire does this automatically feel free 🙂 Otherwise I can't really make any promise when I'm going to be able to look into this
  4. @thibaultvdb In the module settings there is an input for "API Endpoint" — can you try to change the value there to "localhost/api" and report back if this works for you?
  5. @thibaultvdb If what @flydev says is the case and you're trying to access your website inside a subdirectory you could also try to adjust the path for the api in the module settings. Maybe it'll work 🙂
  6. @thibaultvdb It's a bit difficult to help from here. One thing you could try is to go through the code in Router.php and return or exit early to find out until where the code runs. The main functions are "go()" and "handle()". Another idea is to compare php settings between your hosted and local environment with "phpinfo()". If you can isolate the issue it's much easier to help.
  7. @pmichaelis I'm gonna ask anyway: Why? 😉 Seems like a weird server config, but I could add this to the variables the module checks by default.
  8. @pmichaelis If the error is thrown in line 131 it's likeley there is an error with the JWT Authorization. Maybe the Token you're submitting is not valid, maybe something else. Hard to tell with the little information you provided. Oh, just noticed you already mentioned the JWT Auth… 🙂 Probably the error is produced in those 4 lines: $secret = wire('modules')->RestApi->jwtSecret; $token = str_replace('Bearer', '', $authHeader); $token = trim($token); $decoded = JWT::decode($token, wire('modules')->RestApi->jwtSecret, array('HS256')); if the secret is in your config and you didn't change it, I'd check if the token gets transmitted properly with the request.
  9. @siilak I think all you need to do is to add your route in Routes.php: $routes = [ ['PUT', 'user', User::class, 'addUser'], ]; And have some functionality for adding your data in your 'addUser' Function. Let me know, if it works!
  10. @Sebi@pmichaelis Think I'm going to include @pmichaelis since it does not required additional configuration (actually before I used the RestApi Module with NGINX it was using apache_request_headers anyway)
  11. @flydev Thanks for your PR. I'm going to investigate (feel free to remind me, if you don't hear back)! One concern though, do you think it's a good practice to send the password on every request? In this case you'd have to store the password somewhere in your frontend, which I think is security bad practise. Maybe other people do have an opinion about that?
  12. @pmichaelis Is vagrant using an apache or nginx server? Can you check where the authorization header is contained in your case (apache_request_headers or $_SERVER)? And what version of php are you using?
  13. @dragan Yes, it basically only sends a POST Request to a webhook url without any further information. So your assumption is correct 😉 In my case the CI Pipeline does a static build of the website and deploys it on the server. What happens in your build pipeline is totally up to you though. You could also do a request from your pipeline to your API to gather further information if needed. The trigger does not become active for system templates and pages which are not public, this is the related code: // do nothing for system pages: if ($page->template->flags === Template::flagSystem) return; // do nothing if page is not public if (!$page->isPublic) return;
  14. @flydev I adjusted the Regex Pattern for the endpoint url to allow numbers too: https://github.com/thomasaull/RestApi/commit/f2e851faf4b89449bca496d6bea20ee85dc0f6ee Please update the module to 0.0.6 for this to become active
  15. It might be a good idea to make this configurable, so the user can choose between a webhook or select a page to act as the api endpoint. You wanna provide a PR @eelkenet? I'm a bit short of time currently.
  • Create New...