Page 1 of 1

API validation question

Posted: Sun Jul 14, 2019 12:26 am
by pete99
I am running ZoneMinder 1.32 on a Ubuntu 18.04 server. Everything is working fine. I was trying to setup zmNinga but it says my api is not working. I did all of the test on the Validating APIs on https://zmninja.readthedocs.io/en/lates ... g-api.html all of the steps work correctly until I get to step 6.

Step 6: (If you find your APIs show ok, but zmNinja has issues)
Open a browser, log into ZM
Open a new tab, enter http://server/zm/api/host/getVersion.json
Now, right click and do a View Source in your browser (different browsers may have different names for it). This brings up a full source code view of the page. Do you ONLY see the JSON output or do you see gobs of HTML on top like <pre class= and lots of cake related messages? If you do, you need to fix it.

When I enter http://server/zm/api/host/getVersion.json I get the correct response

Code: Select all

{
    "version": "1.32.3",
    "apiversion": "1.0"
}
When I View Source (my case View Page Source) I only get the json I do not see any HTML. Honestly I am not sure which response is correct only seeing only json or seeing HTML? if seeing json only is incorrect does anybody know what to do to fix it?

I am using the API to interface with Home Assistant and it does appear to be working.

Re: API validation question

Posted: Sun Jul 14, 2019 12:40 am
by bbunge
Since your API works you need to take your question to the ZmNinja area of the forum.

Re: API validation question

Posted: Sun Jul 14, 2019 1:40 pm
by iconnor
The json response is not html. It is json. There is no other view or interpretation for json, so view source looks the same as just viewing the json.

Re: API validation question

Posted: Sun Jul 14, 2019 2:57 pm
by pete99
Thanks for the clarification I was pretty sure the API was working. I believe the real issue is that the reverse proxy is not setup correctly. This is my first attempt at setting up a reverse proxy and the learning curve has been steep. At least now I can rule out the API as being an issue and concentrate on getting the reverse proxy working. Thanks