User tests: Successful: Unsuccessful:
Pull Request for Issue # .
A quick fix to allow joomla 4 webservices to work and not returning 404 resource not found.
I just removed an ! to invert the logic. To me it seemed like a typo. But before finding this I had to debug using Postman and PhpStorm.
With this fix: it returns list of articles as expected.
@wilsonge I debugged it really deep using PhpStorm. Tell me what you think if it works for you too. Hope it helps.
Try to access the article webservice using curl or Postman
GET /api/index.php/v1/content/article
GET /api/index.php/v1/content/article should return a list of articles json-api response.
GET /api/index.php/v1/content/article returns Resource not found json response.
no
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
@alexandreelise You can see the drone log files when following the "Details" link right beside the drone result. Then you can see at the left hand side a list of tests, coloured in red if failed, and when selecting such a failed test, you san see on the right hand side the corresponding log.
The PHP 8 unit tests currently fail, this is known and allowed, but in case of your PR the API test failed, too, and when reading the log file it seems to me that it fails when testing for access with bad credentials: It expects to get a 404 response but gets a 401, as far as I understand it. And this could be indeed related to your PR.
@Hackwar @wilsonge Does one of you know the API router well enoguh to tell if the change in this PR is correct or not?
i cannot replicate the issue or better
can you give more detailed info on when this happens please
Hello everyone. I performed the same tests locally with the same tests suite for api tests and all passed fine. Moreover the correct http header for invalid credential is 401 unauthorised not 404 not found. maybe there is some kind of error in this api test regarding the bad credential. Thanks for your time and patience.
We'd expect it to strip index.php when the setting is enabled (combined with a htaccess/nginx change server side like we require when enabling this setting in the frontend)
I have tested this item
I have:
If I do a GET call to {{base_path}}/api/v1/content/article
it returns 404 Not Found
Maybe I didn't have the same version of the code as anyone in this discussion has. I will retry on nightlies of Joomla 4.x and I'll give you all some feedback.If it still won't work, hopefully someone will fix the problem. If there is no apparent problem. Just let it be. Take care. Have a great day. Thanks for your time and patience.
Title |
|
@alexandreelise @infograf768 @SharkyKZ Tested #28394 in connection with #29020 and indeed it allows the API to work when 'Use URL Rewriting' has been selected in Global Configuration. However, if 'Use URL Rewriting' has not been selected, we get 404 - Resource not found.
IMHO, we cannot require websites that expose web services to be consumed by their systems to use 'Use URL Rewriting', even though that would make sense. Is there a simple solution where both modes can be supported?
This is not the correct fix. See #26564 (comment) for the proposed solution.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-05-24 15:33:27 |
Closed_By | ⇒ | Quy | |
Labels |
Added:
?
|
This looks correct on code review, going to re-open this for now. But we still need .htaccess
for API.
Status | Closed | ⇒ | New |
Closed_Date | 2020-05-24 15:33:27 | ⇒ | |
Closed_By | Quy | ⇒ |
Status | New | ⇒ | Pending |
Should both versions, with and without index.php
, work regardless of rewrite setting? Like it does in site app? If so, the check can be removed and index.php
should always be stripped out because regexps never include it.
Behaviour should be the same as the site apps. But we don't have the magic router for the build function - unsure quite how that impacts us honestly https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Router/SiteRouter.php#L550-L576
In that case the option check can be removed and index.php
always stripped.
But we don't have the magic router for the build function - unsure quite how that impacts us honestly
URLs are built based on current URL. I.e. if current URL has index.php
, all URLs built also going to have it, regardless of rewrite option. Is this intended behavior?
@alexandreelise can you please test #29303 I think this should be the correct fix for the issues you have experienced
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-05-31 19:31:03 |
Closed_By | ⇒ | Quy |
Thanks @nikosdion for addressing the issue and solve it. Didn't try yet but hopefully it should work as for everybody else. Take care everybody. Joomla 4 is closer and closer. Official Beta 1 out today. Woohoo! It will help me for my webservice presentation june 12 2020.
I launched the api-tests locally using what is provided in the official 4.0-dev branch and it was successful even with a non-standard port for https. Not sure why drone-ci is complaining for api-tests.