New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Errors #36724
Comments
This comment was marked as abuse.
This comment was marked as abuse.
you need to have only 1 api-authentication plugin enabled |
@nobicycle Please disable the "API Authentication - Web Services Basic Auth" and report back if the error persists or not. Thanks in advance. |
Thanks for replies. Using a freshly installed 4.06 without "API Authentication - Web Services Basic Auth" disabled, obviously with new token, I get the same error.
Also with a different request (users) ... the same
Again, base url is OK
|
To me it looks like server error, wrong path or something.
The base url may be ok, but what about whole path? |
made i quick test with nginx and confirm what is reported all fine with apache |
Since apache was confirmed above OK, I tried it: I have apache 2.4.52 running on port 8011 It produces 401 Unauthorized
Server config:
|
can you try the following
or via postman when your server is apache |
Same thing but root url:
|
so with apache it's working right ? @nobicycle |
Requests below ... OK
But articles ... after creating one, title 'test', article-text 'test' and saving ...
Note, the doc https://docs.joomla.org/J4.x:Joomla_Core_APIs#Get_List_of_Articles says the call whould be with content, not contents
|
Hi alikon, I replied o you above. |
Single Menu Fails
All menus is OK``` $ curl --location --request GET 'http://joomla4.localdomain:8011/api/index.php/v1/menus/site' --header "X-Joomla-Token: $TOKEN" --data-raw ''
|
you should use this for menu item |
Alikon, thank you. I misread the api doc. How about Content . Do you confirm the error below in apache:
Note: I tested all these routes with GET banners |
I cannot confirm your findings about p.s |
"i need more details for that" I am using official Joomla Documentation https://docs.joomla.org/J4.x:Joomla_Core_APIs#Create_Menu Some errors during testing: Install Language Documentationcurl -X POST -H "Content-Type: application/json" /api/index.php/v1/languages -d { Testing
Get Single Content Language Documentationcurl -X GET /api/index.php/v1/v1/languages/content/{language_id} { Update Content Language
Get Single Article
|
Be sure to use the ID value under System > Content Languages. |
I was having a similar issue with Joomla 4.1.2 running Nginx 1.18.0 on Ubuntu 20.04. No Joomla API calls were working until I changed my Nginx location config as follows (first line with location directive was only change I made):
} which I got from here. Previously had the 1st line as: location ~ .php$ { Interested if this fixes your issue. |
Sorry for the late reply, which is a 'no', , but I gave up on the API ever working. People have moved on to items such as cookie handling in Joomla 4.3 Never mind that the API core feature does not work on the most popular webserver. Taking the standard example from the famous Joomla leader who specified the API: #27021
Whereas 'location ~ .php$ {' produces asolutely nothing. Note: correct plugins are enabled. |
Cecille filed a contact request on my site about this issue earlier today but did not leave a valid reply email address. Even though I didn’t write the Joomla API, just its authentication plugin, I can help you as I do use the Joomla API extensively — it’s how I’ve been publishing software on my site, among other uses. You have three problems which are simple to solve. 1. You need URL rewriting on your server to use the Joomla APIWhat you need to do is already documented in https://docs.joomla.org/Nginx Please note that you have not done everything mentioned in there. Critically, you do not have the 2. Using Authorization: Bearer may not work on some serversUse the
3. You need to set the Accept header to application/vnd.api+jsonThis is required. It's the only acceptable representation for JSON API responses.
When everything comes togetherAfter you fix your NginX config (and reload the configuration!) your request looks like this:
I hope this helps getting you back to the right direction :) |
Thank you sir. Working now. |
Steps to reproduce the issue
TOKEN=c2hhMjU2OjczMzo5NmFhZWRkYWYyNDEyZDA3MjAyMDk1YjA1NzJjOTZmYTc2NTJlMDY0ZjQ2NmJlZGNhNDhkNTA2MjQ5NjUwMzU2
curl -H "Authorization: Bearer $TOKEN" 'http://joomla4.localdomain/api/index.php/v1/tags'
Expected result
Json output
Actual result
System information (as much as possible)
Proof the base URL is OK:
$ uname -a
Linux tower 5.10.89-1-MANJARO #1 SMP PREEMPT Wed Dec 29 18:09:17 UTC 2021 x86_64 GNU/Linux
Additional comments
The text was updated successfully, but these errors were encountered: