API Commands Not Found - Ubuntu 16.04

Forum for questions and support relating to the 1.29.x releases only.
Locked
macfloripa
Posts: 9
Joined: Sun Sep 11, 2011 3:13 pm

API Commands Not Found - Ubuntu 16.04

Post by macfloripa »

I have ZM 1.29.0 with Ububtu 16.04 - fresh install. Got everything working and want to try out the API.

When I try the API commands as per the documentation I get command not found (after getting cookie information).

------

Code: Select all

$ curl -b cookies.txt http://localhost/zm/api/monitors.json
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /zm/api/monitors.json was not found on this server.</p>
<hr>
<address>Apache/2.4.18 (Ubuntu) Server at localhost Port 80</address>
</body></html>
-------

This makes sense, because when I go to the api directory - this is what I see:

Code: Select all

/usr/share/zoneminder/www/api$ ls -l
total 40
drwxr-xr-x 15 www-data www-data  4096 May 12 10:35 app
-rw-r--r--  1 www-data www-data   174 Feb  3 17:30 build.properties
-rw-r--r--  1 www-data www-data 10315 Feb  3 17:30 build.xml
-rw-r--r--  1 www-data www-data   837 Feb  3 17:30 composer.json
-rw-r--r--  1 www-data www-data  3252 Feb  3 17:30 CONTRIBUTING.md
-rw-r--r--  1 www-data www-data  1454 Feb  3 17:30 index.php
drwxr-xr-x  3 www-data www-data  4096 May  1 22:20 lib
-rw-r--r--  1 www-data www-data   437 Feb  3 17:30 README.md
It looks like the API commands were not installed with the package? Am I missing something?
Thanks in advance....

-----------


Code: Select all

/usr/share/zoneminder/www$ ls -l
total 48
drwxr-xr-x 2 www-data www-data 4096 May  1 22:20 ajax
drwxr-xr-x 4 www-data www-data 4096 May  1 22:20 api
drwxr-xr-x 2 www-data www-data 4096 May  1 22:20 css
lrwxrwxrwx 1 www-data www-data   28 Apr  5 10:50 events -> /var/cache/zoneminder/events
drwxr-xr-x 2 www-data www-data 4096 May  1 22:20 graphics
lrwxrwxrwx 1 www-data www-data   28 Apr  5 10:50 images -> /var/cache/zoneminder/images
drwxr-xr-x 2 www-data www-data 4096 May  1 22:20 includes
-rw-r--r-- 1 www-data www-data 6435 Feb  3 17:30 index.php
drwxr-xr-x 2 www-data www-data 4096 May  1 22:20 js
drwxr-xr-x 2 www-data www-data 4096 May  1 22:20 lang
drwxr-xr-x 5 www-data www-data 4096 May  1 22:20 skins
lrwxrwxrwx 1 www-data www-data   28 May 12 10:13 sounds -> /var/cache/zoneminder/sounds
lrwxrwxrwx 1 www-data www-data   26 Apr  5 10:50 temp -> /var/cache/zoneminder/temp
drwxr-xr-x 3 www-data www-data 4096 May  1 22:20 tools
drwxr-xr-x 2 www-data www-data 4096 May  1 22:20 views
bbunge
Posts: 2951
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: API Commands Not Found - Ubuntu 16.04

Post by bbunge »

What install document did you use?
bbunge
Posts: 2951
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: API Commands Not Found - Ubuntu 16.04

Post by bbunge »

bbunge wrote:What install document did you use?
Sorry, I should have said look here for instructions: https://wiki.zoneminder.com/Ubuntu_Serv ... e_easy_way

I just checked a Live DVD version and the API responded.

bb
macfloripa
Posts: 9
Joined: Sun Sep 11, 2011 3:13 pm

Re: API Commands Not Found - Ubuntu 16.04

Post by macfloripa »

I did use those instructions, yes. Strange.
Can someone tar up the /usr/share/zoneminder/www/api directory for me?
mrLitter
Posts: 5
Joined: Sat May 14, 2016 7:56 pm

Re: API Commands Not Found - Ubuntu 16.04

Post by mrLitter »

I got API working by picking out the following steps from https://wiki.zoneminder.com/Ubuntu_Serv ... e_easy_way
a2enmod rewrite

Fix Permissions

chown -R www-data:www-data /usr/share/zoneminder/

Fix to allow API to work

nano /etc/apache2/apache2.conf

Change None to All two places as shown below

<Directory /usr/share>
AllowOverride All
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Ctrl+o Enter to save

CTRL+x to exit
macfloripa
Posts: 9
Joined: Sun Sep 11, 2011 3:13 pm

Re: API Commands Not Found - Ubuntu 16.04

Post by macfloripa »

Thanks for the reply, mrLitter.

I redid what you suggested.

However, it seems that in my installation, the api commands were not included in the install.

I'll have to try a re-install, unless some kind soul will tar and zip up their api directory from an ubuntu machine and send it to me...
bbunge
Posts: 2951
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: API Commands Not Found - Ubuntu 16.04

Post by bbunge »

I just did a fresh install on Ubuntu 16.04 server using the WIKI instructions and the API was there.

bb
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: API Commands Not Found - Ubuntu 16.04

Post by asker »

These are not api commands - if your apache configuration is not setup properly, it will not be found. I am very sure you did not follow all the instructions for setup. My suggestion is to follow the wiki instructions folks have posted ad pedem litterae

macfloripa wrote:Thanks for the reply, mrLitter.

I redid what you suggested.

However, it seems that in my installation, the api commands were not included in the install.

I'll have to try a re-install, unless some kind soul will tar and zip up their api directory from an ubuntu machine and send it to me...
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
Locked