Jump to content

thomasaull

Members
  • Content Count

    68
  • Joined

  • Last visited

  • Days Won

    2

thomasaull last won the day on September 19 2018

thomasaull had the most liked content!

Community Reputation

101 Excellent

About thomasaull

  • Rank
    Full Member

Contact Methods

  • Website URL
    www.thomasaull.de

Profile Information

  • Location
    Würzburg, Germany

Recent Profile Visitors

1,584 profile views
  1. @lemgrago I think at the moment the module only supports a single depth of grouping. I did a quick check and it doesn't work for me either. If it helps you can always declare your routes like: 'firstlevel/secondlevel' => [ ['GET', 'endpoint', Example::class, 'test'], ], 'firstlevel/another-secondlevel' => [ ['GET', 'endpoint', Example::class, 'test'], ], I might add multiple nested groups in the future
  2. Hi @joshua, thanks for finding it useful 😉 Personally I mostly use the RestAPI Module to gather data from multiple sources for a single endpoint. For example a blogpost might have info about the post itself, but also might pull in additional data about the author which might live on a completely different page. However I can think of usecases like yours where bascially a dump of all the data might be useful. Unfortunately there is no built in functionality for this in the module. You could check out http://modules.processwire.com/modules/pages2-json/ which does a similar thing or the GraphQL Module (http://modules.processwire.com/modules/process-graph-ql/) also goes in this direction.
  3. 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?
  4. @dragan Can you please check your php error log too?
  5. @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
  6. @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?
  7. @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 🙂
  8. @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.
  9. @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.
  10. @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.
  11. @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!
  12. @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)
  13. @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?
  14. @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?
  15. @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;
×
×
  • Create New...