API validation question

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
Posts: 4
Joined: Fri Dec 14, 2018 1:07 am

API validation question

Post by pete99 » Sun Jul 14, 2019 12:26 am

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.

Posts: 2431
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: API validation question

Post by bbunge » Sun Jul 14, 2019 12:40 am

Since your API works you need to take your question to the ZmNinja area of the forum.

User avatar
Posts: 813
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto

Re: API validation question

Post by iconnor » Sun Jul 14, 2019 1:40 pm

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.

Posts: 4
Joined: Fri Dec 14, 2018 1:07 am

Re: API validation question

Post by pete99 » Sun Jul 14, 2019 2:57 pm

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

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests