API returns 404 - please help!!

Community Support for Booked Scheduler
Post Reply
Nofaddey
Posts: 8
Joined: Wed Jul 29, 2020 11:56 am

API returns 404 - please help!!

Post 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

Nofaddey
Posts: 8
Joined: Wed Jul 29, 2020 11:56 am

Re: API returns 404 - please help!!

Post 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

Nofaddey
Posts: 8
Joined: Wed Jul 29, 2020 11:56 am

Re: API returns 404 - please help!!

Post 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

User avatar
TechCoder
Posts: 68
Joined: Mon Aug 10, 2020 12:54 pm
Contact:

Re: API returns 404 - please help!!

Post 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.
Apps-n-Add-Ons.com is independently owned and operated and provides clients worldwide with Plugins for Booked Scheduler to solve common needs.
Custom software solutions, paid help, Booked Hosting and more..... Apps-n-Add-Ons.com

Post Reply