There a way to delete/re-create a new API token?

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
FormBurden
Posts: 2
Joined: Mon Oct 04, 2021 5:21 pm

There a way to delete/re-create a new API token?

Post by FormBurden »

Debian 10 server
ZoneMinder 1.36.7

While trying to set up the Machine Learning Hooks using EventServer, I've gotten so close to actually get it to work after several hours of working it. But I've been getting this error on the logs:

Code: Select all

raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://localhost/zm/api-token-here
From when I ran this manually using the debug:

Code: Select all

sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini  --eventid <eid> --monitorid <mid> --debug
Essentially on the https://zmeventnotification.readthedocs ... Guide Here I've completed everything until the testing part, which gives me those errors. So (and I could be wrong), I'm thinking it's maybe how the 2.0 API works how it expires or something, and clearly when I made my API token was HOURS before I even got all this working correctly. So I'm thinking it's an API issue. Hopefully.

I tried finding anywhere to re-new/re-create a new API token, but whenever I run the:

Code: Select all

curl -XPOST -d "user=yourusername&pass=yourpassword" https://yourserver/zm/api/host/login.json
whether I do the localhost or my domain, I get the same issue. I wouldn't say it's an error really, but I think when I was messing with the configs, I accidentally had two "zm" in the URL. This is what I get:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://localhost/zmzm/api/host/login.json">here</a>.</p>
<hr>
<address>Apache/2.4.38 (Debian) Server at localhost Port 80</address>
</body></html>

As you can see in "The document has moved" there is two "zmzm" in the url.

So I thought possibly this could be the issue of the above 404 error. Not entirely sure, but all the documentation I could ever find doesn't have anything on this. Can I somehow delete

Code: Select all

"https://localhost/zmzm/api/host/login.json"
so I could possibly create a whole new API fresh (maybe through "curl" command?), because like I said when I run the API code it gets moved to that URL and I think that could be the issue to all this.

Could be wrong and it's something completely different with the 404 error. So let me know. Any other info, let me know.
FormBurden
Posts: 2
Joined: Mon Oct 04, 2021 5:21 pm

Re: There a way to delete/re-create a new API token?

Post by FormBurden »

After lots of troubleshooting I came with my own conclusion to the matter.

When I was doing all of this, I created a self signed certificate for ZoneMinder, which in turn from having the url issue caused this. But when I went the letsEcrypt route it made a completely new API for me, and the issue was resolved.
Post Reply