Page 1 of 1
API configuration issues
Posted: Tue Aug 30, 2016 3:25 pm
by bforcier
Hello,
I recently upgraded to 1.29 and am trying to setup the API for use with zmnija. I followed the guide posted on the wiki for apache and zm configuration but I can't get the app to talk to the API. When I do
http://serverip/zm/api: I get "The requested URL /zm/api was not found on this server."
http://serverip/zm/api/host/getVersion.json I don't see anything. I actually don't even have a host folder in my api directory.
Everything in /usr/share has the same user/owner (www-data). My apache2.conf has entries described on the wiki. Not sure what else I could be missing.
Thanks
Re: API configuration issues
Posted: Tue Aug 30, 2016 8:59 pm
by asker
How exactly did you upgrade? Which guide did you follow?
Re: API configuration issues
Posted: Tue Aug 30, 2016 9:31 pm
by bforcier
I removed with purge, autoremove, and cleared the zm database then followed this:
https://wiki.zoneminder.com/Ubuntu_Serv ... e_easy_way
Re: API configuration issues
Posted: Tue Aug 30, 2016 10:51 pm
by asker
If you followed that guide verbatim and are sure you did not miss steps, then the Api parh should be server/zm/api not server/api as you wrote below?
Re: API configuration issues
Posted: Tue Aug 30, 2016 11:56 pm
by bforcier
Yes. Sorry about that
http://serverip/zm/api is what was configured (edited in original) this returns 404.
Re: API configuration issues
Posted: Wed Aug 31, 2016 1:09 pm
by asker
Try these, and please post the exact output from all of these. Thanks.
Code: Select all
cat /usr/share/zoneminder/www/api/.htaccess
Code: Select all
cat /usr/share/zoneminder/www/api/app/.htaccess
Code: Select all
cat /usr/share/zoneminder/www/api/app/webroot/.htaccess
Code: Select all
cat /etc/apache2/conf-enabled/zoneminder.conf #replace zoneminder.conf with any other config you may be using
Re: API configuration issues
Posted: Mon Sep 12, 2016 11:08 am
by Zenw1e
hi, asker!
We have same problem weet API. ZM works good, but our chief wants to explore cameras from he's smartphone (iPhone 6). We have bought zmninja from AppMarket, then install it, But ZMNinja request an API.
My API doesn't work, i' got error (see attachment)
What would i do?
Linux Debian 8.0
ZM 1.29.0
I'm trying by your steps:
Code: Select all
root@stk-video-01:/etc/apache2# a2enmod rewrite
Module rewrite already enabled
root@stk-video-01:/etc/apache2# cat /usr/share/zoneminder/www/api/.htaccess
cat: /usr/share/zoneminder/www/api/.htaccess: No file or directory is found
root@stk-video-01:/etc/apache2# cat /usr/share/zoneminder/www/api/app/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
RewriteBase /zm/api
</IfModule>
root@stk-video-01:/etc/apache2# cat /usr/share/zoneminder/www/api/app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteBase /zm/api
</IfModule>
root@stk-video-01:/etc/apache2# cat /etc/apache2/conf-enabled/zoneminder.conf
# Remember to enable cgi mod (i.e. "a2enmod cgi").
ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AllowOverride All
Require all granted
</Directory>
Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
php_flag register_globals off
Options Indexes FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
</Directory>
<Directory /usr/share/zoneminder/www/api>
AllowOverride All
</Directory>
root@stk-video-01:/etc/apache2#
Re: API configuration issues
Posted: Mon Sep 12, 2016 2:06 pm
by asker
Are you sure you did
sudo a2enmod rewrite
edit: looks like you already did it
How exactly did you upgrade?
Re: API configuration issues
Posted: Mon Sep 12, 2016 2:09 pm
by asker
Hmm, looks like your .htaccess file is missing in api/ - not sure how you upgraded
Try this:
Code: Select all
cp /usr/share/zoneminder/www/api/app/.htaccess /usr/share/zoneminder/www/api/.htaccess
Re: API configuration issues
Posted: Tue Sep 13, 2016 5:55 am
by Zenw1e
Thanx, i tried to
Code: Select all
root@stk-video-01:/etc/apache2# cp /usr/share/zoneminder/www/api/app/.htaccess /usr/share/zoneminder/www/api/.htaccess
then try to open.
I have no upgrade to 1.29.0
Clear install was be with 1.29.0 version.
Re: API configuration issues
Posted: Tue Sep 13, 2016 8:26 am
by Zenw1e
Thanx a lot, asker!
I have solved my problem.
Problem was in file:
Code: Select all
root@stk-video-01:/usr/share/zoneminder/www/api# cat /usr/share/zoneminder/www/api/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ /webroot/ [L]
RewriteRule (.*) /webroot/$1 [L]
RewriteBase /zm/api
</IfModule>
In this case API doesn't work. But i turn on my other ZM server and make:
Code: Select all
root@stk-video-01:/usr/share/zoneminder/www/api# cat /usr/share/zoneminder/www/api/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
RewriteBase /zm/api
</IfModule>
Then, i corrected my /usr/share/zoneminder/www/api/.htaccess file and paste "app", reload apache2 and GOOD!
THANX!