Page 1 of 1

API returns 404 - please help!!

Posted: Fri Jan 22, 2021 11:28 am
by Nofaddey
Hi,

I have enabled API access and I can reach the documentation page at /Web/Services/index.php but when I try to do any of the calls in the documentation using postman I get 404 (hitting /Web/Services/index.php/Accounts/ for example).

please can anyone make any suggestions as to why I'm seeing this behaviour and how to resolve it?

Running version 2.8.3

Thanks

Re: API returns 404 - please help!!

Posted: Fri Jan 22, 2021 11:44 am
by Nofaddey
Noticed within /Web/Services/ folder on the box the folder only contains index.php Help(folder) Authentication(folder). is it normal for it to be like this, I would have expected and Accounts folder or file to handle the api call or something?

Also made a typo on the post I meant (hitting /Web/Services/Accounts/ for example).

Thanks

Re: API returns 404 - please help!!

Posted: Fri Jan 22, 2021 1:16 pm
by Nofaddey
Issue looks in relation to me using Nginx instead of apache.

nginx block looks like this currently and works fine for using the frontend only:
server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html/booked;

# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;

server_name ryanbooked.com;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}

Anyone know what changes need to be made to allow nginx to handle the rest api of booked?

Thanks

Re: API returns 404 - please help!!

Posted: Fri Jan 22, 2021 1:50 pm
by TechCoder
There are quite a few things that have to be in place to get the API working (they are nothing drastically different than most other APIs, but for someone new, they are a bit daunting.....)

I (pretty highly) recommend you consider saving your valuable time in 'hacking around' and go where you can learn quickly what works and have a template to make your next API (which you will likely use often in today's world) interface.

We have a fully-working API Class at https://apps-n-add-ons.com/product.php? ... edAPIClass which is written in easy-to-understand ('simple PHP') language. Many find it a great learning tool - and, it also gets you going on your API interface instantly - which then lets you get to the important part of your programming.

Re: API returns 404 - please help!!

Posted: Thu Apr 22, 2021 7:29 am
by JaviRivela
@Nofaddey, where you able to solve this problem?

I'm in the same point, I don't know why, i can't see this help page and I'm not sure how to use the API that it's included in booked.
Nofaddey wrote:
Fri Jan 22, 2021 11:28 am
Hi,

I have enabled API access and I can reach the documentation page at /Web/Services/index.php but when I try to do any of the calls in the documentation using postman I get 404 (hitting /Web/Services/index.php/Accounts/ for example).

please can anyone make any suggestions as to why I'm seeing this behaviour and how to resolve it?

Running version 2.8.3

Thanks

Any help is welcome!

thanks

Re: API returns 404 - please help!!

Posted: Thu Apr 22, 2021 12:20 pm
by JaviRivela
Hello Nofaddey,

Could you make the API rest work?
I'm trying with apache, but I can`t reach the documentation page at /Web/Services/index.php so I don't know what I need to configure.
Could you tell me how to do it?

Thanks!

Re: API returns 404 - please help!!

Posted: Thu Dec 02, 2021 5:37 pm
by dimitrism
Have you found any solution?
I am using apache, however I meet the same problem!