Page 1 of 2
API doesn't work.HELP
Posted: Mon Aug 03, 2020 10:52 am
by testsia
Hello smart people.
Help me figure it out.
I have zoneminder configured on Ubuntu.
I access it from the internet and see my cameras.
But I want to see cameras through the app zmNinja on my phone.
I check the work API local:
http://ip-local/zm/index.php
works great
Port forwarding is configured on my router.
I check the work API internet:
http://ip-internet/zm/index.php
works great
but when i try to run the app and see the cameras i get an error.
zmninja api error
What am I doing wrong?
LOG:
zmNinja version:1.4.009 (desktop)
ZoneMinder version:
Aug 3, 2020 01:50:05 PM DEBUG Does login need to hear the wizard? false
Aug 3, 2020 01:50:06 PM DEBUG User tapped save, calling SaveItems
Aug 3, 2020 01:50:06 PM DEBUG Clearing Multiport...
Aug 3, 2020 01:50:06 PM DEBUG Clearing all unsupported flags
Aug 3, 2020 01:50:06 PM DEBUG obfuscate: original:13338 obfuscated:2776 scheme:lzs
Aug 3, 2020 01:50:06 PM DEBUG CACHE: Flushing all network API caches...
Aug 3, 2020 01:50:06 PM DEBUG Inside save Items
Aug 3, 2020 01:50:06 PM DEBUG Setting isFirstUse to:false
Aug 3, 2020 01:50:06 PM DEBUG obfuscate: original:13338 obfuscated:2776 scheme:lzs
Aug 3, 2020 01:50:06 PM DEBUG Setting server version to:
Aug 3, 2020 01:50:06 PM DEBUG Setting multi-port to:false
Aug 3, 2020 01:50:06 PM DEBUG obfuscate: original:13338 obfuscated:2776 scheme:lzs
Aug 3, 2020 01:50:06 PM DEBUG _doLogoutAndLogin: Clearing cookies
Aug 3, 2020 01:50:06 PM INFO No reachable config: "No servers reachable"
Aug 3, 2020 01:50:06 PM INFO In Auth State trans: Not logged in, requested to go to {"data":{"requireLogin":false},"cache":false,"url":"/invalidapi","templateUrl":"templates/invalidapi.html","controller":"zmApp.InvalidApiCtrl","name":"app.invalidapi"}
Aug 3, 2020 01:50:06 PM INFO Validating APIs at /host/getVersion.json?
Aug 3, 2020 01:50:06 PM INFO Login data not changed, not saving
Aug 3, 2020 01:50:06 PM INFO API login error {"data":null,"status":-1,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"/host/getVersion.json?","headers":{"Accept":"application/json, text/plain, */*","X-ZmNinja":"zmNinja_%APPVER%"},"withCredentials":true},"statusText":""}
Aug 3, 2020 01:50:06 PM DEBUG Saved isFirstUse ok
Re: API doesn't work.HELP
Posted: Mon Aug 03, 2020 12:39 pm
by asker
testsia wrote: ↑Mon Aug 03, 2020 10:52 am
I check the work API local:
http://ip-local/zm/index.php
works great
Port forwarding is configured on my router.
I check the work API internet:
http://ip-internet/zm/index.php
works great
but when i try to run the app and see the cameras i get an error.
zmninja api error
What am I doing wrong?
Neither of the URLs you listed above are for the API. They are for the web console (two different things).
Please follow
this guide closely.
Re: API doesn't work.HELP
Posted: Mon Aug 03, 2020 1:15 pm
by testsia
I am grateful to you for your answer.
I read the entire manual, I went through each of the points step by step.
My English is not very good.....
But I tried.
I must indicate the address in the program: ???
http://ip-internet/zm/api/monitors.json
The app does not display.
I can give you access. Can you see what's wrong?
Re: API doesn't work.HELP
Posted: Mon Aug 03, 2020 1:44 pm
by asker
Let's forget about the app for now.
Please follow the link I gave above and please post results step by step in the guide. Just use a browser (not zmNinja).
Replace text "server" with your ZM hostname or IP address.
Re: API doesn't work.HELP
Posted: Mon Aug 03, 2020 2:19 pm
by testsia
http://<ip removed>/zm/api/host/getVersion.json
Code: Select all
version "1.34.16"
apiversion "2.0"
http://<ip removed>/zm/api/monitors.json
Code: Select all
0
Monitor
Id "1"
Name "Ogorod"
Notes ""
ServerId "0"
StorageId "0"
Type "Ffmpeg"
Function "Modect"
Enabled "1"
LinkedMonitors null
Triggers ""
Device ""
Channel "0"
Format "0"
V4LMultiBuffer null
V4LCapturesPerFrame "1"
Protocol null
Method "rtpRtsp"
Host "http://192.168.1.10:8899/onvif/device_service"
Port ""
SubPath ""
Path "rtsp://<credentials removed>@192.168.1.10:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream"
Options null
User null
Pass null
Width "1920"
Height "1080"
Colours "4"
Palette "0"
Orientation "ROTATE_0"
Deinterlacing "0"
DecoderHWAccelName null
DecoderHWAccelDevice null
SaveJPEGs "3"
VideoWriter "0"
OutputCodec null
OutputContainer null
.......................................
http://<ip removed>/zm/api/events.json
Code: Select all
events
0
Event
Id "1"
MonitorId "2"
StorageId "0"
SecondaryStorageId "0"
Name "Event- 1"
Cause "Motion"
StartTime "2020-07-31 13:52:44"
EndTime "2020-07-31 13:52:53"
Width "1920"
Height "1080"
Length "9.15"
Frames "61"
AlarmFrames "1"
DefaultVideo ""
SaveJPEGs "3"
TotScore "27"
AvgScore "27"
MaxScore "27"
Archived "0"
Videoed "0"
Uploaded "0"
Emailed "0"
Messaged "0"
Executed "0"
Notes "Motion: All"
StateId "1"
Orientation "ROTATE_0"
DiskSpace "22177248"
Scheme "Medium"
Locked false
MaxScoreFrameId "6"
FileSystemPath "/var/cache/zoneminder/events/2/2020-07-31/1"
1
Config Server
Code: Select all
LANG_DEFAULT
ru_ru
OPT_USE_AUTH
AUTH_TYPE builtin remote
AUTH_RELAY hashed plain none
AUTH_HASH_SECRET
!QAZ2wsx
AUTH_HASH_IPS
AUTH_HASH_TTL
2
AUTH_HASH_LOGINS
ENABLE_CSRF_MAGIC
OPT_USE_API
OPT_USE_LEGACY_API_AUTH
OPT_USE_EVENTNOTIFICATION
OPT_USE_GOOG_RECAPTCHA
OPT_GOOG_RECAPTCHA_SITEKEY
OPT_GOOG_RECAPTCHA_SECRETKEY
SYSTEM_SHUTDOWN
TIMEZONE
(GMT+02:00) Europe, Rome
OPT_FAST_DELETE
FILTER_RELOAD_DELAY
300
FILTER_EXECUTE_INTERVAL
60
MAX_RESTART_DELAY
600
STATS_UPDATE_INTERVAL
60
WATCH_CHECK_INTERVAL
10
WATCH_MAX_DELAY
45
RUN_AUDIT
AUDIT_CHECK_INTERVAL
900
AUDIT_MIN_AGE
86400
OPT_CONTROL
OPT_TRIGGERS
CHECK_FOR_UPDATES
CSP_REPORT_URI
TELEMETRY_DATA
TELEMETRY_INTERVAL
14*24*60*60
UPDATE_CHECK_PROXY
SHM_KEY
0x7a6d0000
COOKIE_LIFETIME
3600
Re: API doesn't work.HELP
Posted: Mon Aug 03, 2020 2:47 pm
by asker
This looks good. Can you make sure these APIs work from your mobile phone too? (Same test, using a mobile browser). If it works, please post a picture of your zmNinja settings page.
Re: API doesn't work.HELP
Posted: Mon Aug 03, 2020 3:00 pm
by testsia
Screenshots below.
I also tried to install zmninja-pro on my computer and I get the same error
(links removed by admin to take out private data)
Code: Select all
*** Before you send the logs, please make sure you remove any sensitive information. zmNinja tries to filter out passwords, but it is possible that passwords will be included if you include them in URLs, for example ***
zmNinja version:1.4.009 (desktop)
ZoneMinder version:
Aug 3, 2020 05:58:11 PM DEBUG Clearing all unsupported flags
Aug 3, 2020 05:58:11 PM DEBUG obfuscate: original:32491 obfuscated:5582 scheme:lzs
Aug 3, 2020 05:58:11 PM DEBUG CACHE: Flushing all network API caches...
Aug 3, 2020 05:58:15 PM DEBUG Does login need to hear the wizard? false
Aug 3, 2020 05:58:17 PM DEBUG User tapped save, calling SaveItems
Aug 3, 2020 05:58:17 PM DEBUG Clearing Multiport...
Aug 3, 2020 05:58:17 PM DEBUG Clearing all unsupported flags
Aug 3, 2020 05:58:17 PM DEBUG obfuscate: original:32491 obfuscated:5582 scheme:lzs
Aug 3, 2020 05:58:17 PM DEBUG CACHE: Flushing all network API caches...
Aug 3, 2020 05:58:18 PM DEBUG Inside save Items
Aug 3, 2020 05:58:18 PM DEBUG Setting isFirstUse to:false
Aug 3, 2020 05:58:18 PM DEBUG obfuscate: original:32491 obfuscated:5582 scheme:lzs
Aug 3, 2020 05:58:18 PM DEBUG Setting server version to:
Aug 3, 2020 05:58:18 PM DEBUG Setting multi-port to:false
Aug 3, 2020 05:58:18 PM DEBUG obfuscate: original:32491 obfuscated:5582 scheme:lzs
Aug 3, 2020 05:58:18 PM DEBUG _doLogoutAndLogin: Clearing cookies
Aug 3, 2020 05:58:18 PM INFO No reachable config: "No servers reachable"
Aug 3, 2020 05:58:18 PM INFO In Auth State trans: Not logged in, requested to go to {"data":{"requireLogin":false},"cache":false,"url":"/invalidapi","templateUrl":"templates/invalidapi.html","controller":"zmApp.InvalidApiCtrl","name":"app.invalidapi"}
Aug 3, 2020 05:58:18 PM INFO Validating APIs at /host/getVersion.json?
Aug 3, 2020 05:58:18 PM INFO Login data not changed, not saving
Aug 3, 2020 05:58:18 PM INFO API login error {"data":null,"status":-1,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"/host/getVersion.json?","headers":{"Accept":"application/json, text/plain, */*","X-ZmNinja":"zmNinja_%APPVER%"},"withCredentials":true},"statusText":""}
Aug 3, 2020 05:58:18 PM DEBUG Saved isFirstUse ok
which reference is correct?
http://ip-internet/zm/api/monitors.json
or
http://ip-internet/zm/api
????
Re: API doesn't work.HELP
Posted: Mon Aug 03, 2020 3:04 pm
by asker
1. Please post a screenshot of your zmNinja app settings screen (Menu->Settings)
2. It looks like you don't have any authentication in ZM enabled. I was able to directly use your IP and see results (I've removed the IP from the API posts). If you don't have authentication enabled, please make sure you turn off authentication in zmNinja
3. Go to zmNinja->Menu->clear API cache, exit app and start again
Re: API doesn't work.HELP
Posted: Mon Aug 03, 2020 5:07 pm
by testsia
<admin deleted>
my head is already spinning ... did as you said
Re: API doesn't work.HELP
Posted: Mon Aug 03, 2020 5:54 pm
by asker
Ok, let me take a look.
Can you send me access details of ZM console ? pliablepixels @ gmail
(Also, please make sure your logs/pictures don't have personal info like public IPs - if you don't have auth, anyone can access them)
Re: API doesn't work.HELP
Posted: Mon Aug 03, 2020 8:32 pm
by asker
Please don't send me messages via the forum. Can you please contact me via email at pliablepixels gmail com
Re: API doesn't work.HELP
Posted: Tue Aug 04, 2020 10:42 am
by david1234
can I connect to you also ?
I did everything it said in the manual ,
but the API is not working
I get error
Code: Select all
curl -XPOST -d "user=David&pass=DavidPass" http://10.0.0.105/zm/api/login.json
{"name":"Not Found","message":"Not Found","url":"\/api\/zm\/api\/host\/login.json"
Thanks,
Re: API doesn't work.HELP
Posted: Tue Aug 04, 2020 12:24 pm
by asker
Re: API doesn't work.HELP
Posted: Tue Aug 04, 2020 12:59 pm
by david1234
same resualt
Code: Select all
curl -XPOST -d "user=David&pass=Davidpass" http://10.0.0.105/zm/api/host/login.json
{"name":"Not Found","message":"Not Found","url":"\/api\/zm\/api\/host\/login.json"}pi@raspberrypi:~$
Re: API doesn't work.HELP
Posted: Tue Aug 04, 2020 1:04 pm
by asker
There is something wrong with how you have configured your API.
"url":"\/api\/zm\/api\/host\/login.json"
Unfortunately, that is not something I can help 1-1 with. You may want to start a new thread about it and mention your OS, how you installed etc. Looks like a API routing problem. This is a different issue from the OP who had API working correctly, but zmNinja erroring. In your case, the API itself seems misconfigured.