Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Vanilla API get not found using the provided endpoint
cassiofagundes
New
Hi!
I am using Vanilla, version 2.2.12, and Vanilla API addon, version 0.1.3!
The endpoint i get in API config is http://vanilla/api
But i get not found everytime i try to acces, i try with the postman client collection that kasper provided, and still getting not found.
Someone have a lead what could be, or what i am doing wrong?
Thanks in advance
Tagged:
0
Best Answer
-
Kasper Vanilla Staff
As @peregrine mentioned, your nginx config is likely conflicting with the API application. This is the config I personally use for all my Vanilla setups: https://github.com/kasperisager/vagrant-lnpp/blob/master/modules/lnpp/templates/nginx/vanilla.conf.erb
4
Answers
Welcome to the community!
API calls are done through the API controller. You still have to choose an actual endpoint.
For example, you should be able to get a list of discussions using
{domain}/api/discussions
.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
When i try to use api controller i get a not found page, already try http://vanilla/api/discussions, and get a not found page
Someone else have a clue what this could be?
What does your request look like?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I have a localhost enviroment at http://vanilla/
Try a get request like this: http://vanilla/api/categories/:1
Also try a delete request via postman client:
You need an Accept header and you need to specify the id (you are using
:1
which is a named parameter, perhaps you meant1
?).Can you view the site normally? What does the URL for that discussion look like in your browser?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight I try with text/plain value in Accept header.
I view the site normally, this is how the url for that discussion look like:
http://vanilla/discussion/1/bam-you-ve-got-a-sweet-forum#latest
Your accept header should probably be 'application/json'
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight Try to get a list of categories, change the accept header to application/json
still 404
The http://vanilla/api/categories is correct right?
I don't know what your local server configuration is. Only you do!
Is the API application enabled?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight Yes, is enabled!
Here is the settings:
Your token doesn't look like it is constructed properly, but that should throw an authentication error.
What version of Vanilla are you running? (Derp, you said it in your first post) :S
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Cannot imagine that this matters in this case, but I would always use a domain with a dot in it (maybe vanilla.dev) because some browsers (or all?) do not save cookies from domains without dots.
Basically, something is wrong in your dev environment.
What kind of rewrite rules are you using to serve out of http://vanilla/?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight I am using this rewrite rules:
location / {
try_files $uri @site;
}
location @site {
rewrite ^ /index.php?p=$uri&$args last;
}
Thanks for the response @R_J but still getting 404 after include .com in my domain.
@hgtonight I try disable the urlrewrite feature, change my conf in nginx and still not working, my enviroment is a fresh install of vanilla and api, only this i have.
Can you request a non-api page via Postman?
Try http://vanilla/discussions
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight Yes, i can, status 200.
What does your config.php file look like? Block out private info like db passwords and salt.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.