Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid api #426

Closed
itpcss opened this issue Jan 9, 2017 · 11 comments
Closed

invalid api #426

itpcss opened this issue Jan 9, 2017 · 11 comments

Comments

@itpcss
Copy link

itpcss commented Jan 9, 2017

Tell me please, there was a problem connect!

installed zoneminder 1.30 on ubuntu 16.04 server x64, all cameras work perfectly! but zmninja on android 6.0 he writes invalid api, I checked according to the faq Step 4: Type in http://server/zm/api is work all show green!!
and here Step 5: Type in http://server/zm/api/host/getVersion.json - show { "success": false, "data": { "name": "Not Authenticated", "message": "Not Authenticated", "url": "/zm/api/host/getVersion.json", "exception": { "class": "UnauthorizedException", "code": 401, "message": "Not Authenticated", "trace

but! when I disconnect authorization in zoneminder OPT_USE_AUTH normally displays the version as in the instructions { "version": "1.30.0", "apiversion": "1.0" } and zmninja not write "invalid api" and displays all the camera perfectly

Tell me what could be the problem, and I need to work with authorization!

Thanx!

@pliablepixels
Copy link
Member

Hi, please follow the guide at https://github.com/pliablepixels/zmNinja/wiki/Validating-if-APIs-work-on-ZM - to make it work with authentication, you need to follow Step 1 - 5 - you first need to login, and then from the same browser, access the API. Does that work?

@itpcss
Copy link
Author

itpcss commented Jan 9, 2017

All work steps 1-4 and Step 5: Type in http://server/zm/api/host/getVersion.json --> you should see a response like: show show { "success": false, "data": { "name": "Not Authenticated", "message": "Not Authenticated", "url": "/zm/api/host/getVersion.json", "exception": { "class": "UnauthorizedException", "code": 401, "message": "Not Authenticated", "trace - and Log in zmninja working but the camera does not show and outputs "invalid api" though authentication is successful !!!

when I disconnect authorization in zoneminder everything is working in zmninja !!!!!

@pliablepixels
Copy link
Member

pliablepixels commented Jan 9, 2017

I'm sorry, I'm not able to follow.

{ "success": false, "data": { "name": "Not Authenticated", "message": "Not Authenticated", "url": "/zm/api/host/getVersion.json", "exception": { "class": "UnauthorizedException", "code": 401, "message": "Not Authenticated", "trace 

Means authentication is not working. Can you come online on irc.freenode.net channel #zoneminder? we can chat there. My name there is asker.

@itpcss
Copy link
Author

itpcss commented Jan 9, 2017

I took off part of what shows, in the full message is displayed during the transition https://********/zm/api/host/getVersion.json

{ "success": false, "data": { "name": "Not Authenticated", "message": "Not Authenticated", "url": "/zm/api/host/getVersion.json", "exception": { "class": "UnauthorizedException", "code": 401, "message": "Not Authenticated", "trace": [ "#0 /usr/share/zoneminder/www/api/lib/Cake/Event/CakeEventManager.php(243): AppController->beforeFilter(Object(CakeEvent))", "#1 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(677): CakeEventManager->dispatch(Object(CakeEvent))", "#2 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(189): Controller->startupProcess()", "#3 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(HostController), Object(CakeRequest))", "#4 /usr/share/zoneminder/www/api/app/webroot/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))", "#5 {main}" ] }, "queryLog": { "default": { "log": [ { "query": "SELECT Config.Id, Config.Name, Config.Value, Config.Type, Config.DefaultValue, Config.Hint, Config.Pattern, Config.Format, Config.Prompt, Config.Help, Config.Category, Config.Readonly, Config.Requires FROM zm.Config AS Config WHERE Config.Name = 'ZM_OPT_USE_API' LIMIT 1", "params": [], "affected": 1, "numRows": 1, "took": 0 }, { "query": "SELECT Config.Id, Config.Name, Config.Value, Config.Type, Config.DefaultValue, Config.Hint, Config.Pattern, Config.Format, Config.Prompt, Config.Help, Config.Category, Config.Readonly, Config.Requires FROM zm.Config AS Config WHERE Config.Name = 'ZM_OPT_USE_AUTH' LIMIT 1", "params": [], "affected": 1, "numRows": 1, "took": 0 }, { "query": "SELECT Config.Id, Config.Name, Config.Value, Config.Type, Config.DefaultValue, Config.Hint, Config.Pattern, Config.Format, Config.Prompt, Config.Help, Config.Category, Config.Readonly, Config.Requires FROM zm.Config AS Config WHERE Config.Name = 'ZM_OPT_USE_API' LIMIT 1", "params": [], "affected": 1, "numRows": 1, "took": 0 }, { "query": "SELECT Config.Id, Config.Name, Config.Value, Config.Type, Config.DefaultValue, Config.Hint, Config.Pattern, Config.Format, Config.Prompt, Config.Help, Config.Category, Config.Readonly, Config.Requires FROM zm.Config AS Config WHERE Config.Name = 'ZM_OPT_USE_AUTH' LIMIT 1", "params": [], "affected": 1, "numRows": 1, "took": 0 } ], "count": 4, "time": 0 } } } }

@itpcss
Copy link
Author

itpcss commented Jan 9, 2017

all of the steps takes place but is a 5 step shows

@pliablepixels
Copy link
Member

it looks like your ZM APIs are not working with authentication enabled - you need to fix that first before trying zmNinja. Cookies need to be enabled as well in your browser. If you are able to provide me access to your server temporarily, I can check. You can also post in ZoneMinder forums

@pliablepixels
Copy link
Member

closing as no response. Please re-open if you need

@dakota
Copy link

dakota commented Mar 9, 2017

Hey @pliablepixels having the same issue here. Oddly enough api/monitors.json works 100%, but api/host/getVersion.json gives the authentication error.

@pliablepixels
Copy link
Member

hmm if its a ZM API issue, it might be easier to get support on the ZM forums, but I'll try and help. If possible, please join freenode.irc.net #zoneminder - we hang out there

@pliablepixels
Copy link
Member

Closing the loop on the problem reported by @dakota - in his case, the analysis (so far) is that this may be a FreeBSD/FreeNAS specific issue and only affects one controller.

@pliablepixels
Copy link
Member

This issue is a ZM API issue and is now being tracked here
ZoneMinder/zoneminder#1813

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants