zerotier / ZeroTierOne

A Smart Ethernet Switch for Earth
https://zerotier.com
Other
14.65k stars 1.71k forks source link

controller api endpoint /controller/network/<network ID>/active doesn't return json object #491

Closed glycerine closed 7 years ago

glycerine commented 7 years ago

I'm trying to use the documented endpoint to get the active members of a network:

https://github.com/zerotier/ZeroTierOne/tree/master/controller#controllernetworknetwork-idactive

So I do:

curl -H "Authorization: Bearer **" https://my.zerotier.com/controller/network/17d709436c0898a5/active

But I get html instead of json back. Headers omitted, body returned is:

<body><div id="centralUiMain"></div>
</body><script type="text/javascript" src="/index.js"></script></html>
glycerine commented 7 years ago

hmm... none of my /controller calls work. I must not be using that right.

For context, I'm trying to update calls using the endpoint /api/network/%s/member/%s (in https://github.com/unixbigot/gozer) that used to have an ActiveMembers.... but no longer have that.. to still get an active status from the api somehow.

glimberg commented 7 years ago

For the example you posted above, you're missing /api/ in the call. URL should be: https://my.zerotier.com/api/controller/network/17d709436c0898a5/active

glycerine commented 7 years ago

@glimberg Thanks for the hint!

Are you sure that is right? I don't get any reply...

$ curl -H "Authorization: Bearer ******************************" https://my.zerotier.com/api/controller/network/17d709436c0898a5/active
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /api/controller/network/17d709436c0898a5/active</pre>
</body>
$ 
glimberg commented 7 years ago

Take /active off the end as well

glycerine commented 7 years ago

Without the active, I still get an error.

<pre>Cannot GET /api/controller/network/17d709436c0898a5</pre>
glimberg commented 7 years ago

Ohhh. You're looking at the Controller API. That is not public on https://my.zerotier.com/. If you need to access controller data directly, you'll have to run your own network controller. The available public API is listed here: https://my.zerotier.com/help/api

glycerine commented 7 years ago

Gotcha.

I see ActiveMemberCount, but I don't any way to get the "Active" status of each assigned IP address. That used to be returned the ActiveMembers field, but that map is always null now. Is there no way to obtain that information now?

glimberg commented 7 years ago

Try caling https://my.zerotier.com/api/network/<networkid>/member for a list of networks