netbird icon indicating copy to clipboard operation
netbird copied to clipboard

API Call to get connected peers?

Open itsalljustdata opened this issue 3 years ago • 4 comments

Is there a way of making a call to get the connected peers? That way i could parse the returned json data (assuming REST) to get a list of the IPs so that I could stick the records into my pihole custom DNS entries dynamically.

Cheers

itsalljustdata avatar Jun 23 '22 01:06 itsalljustdata

@itsalljustdata In theory yes, but there are caveats. Web UI calls the Management API to get a list of peers with status: https://app.netbird.io:33071/api/peers

However, it requires a JWT token that is generated on auth. It expires after a while, so you will need to re-authenticate. Probably this won't fit your use case.

P.S. We are working on API separately and will be releasing it compatible with OpenAPI.

braginini avatar Jun 23 '22 06:06 braginini

Cheers Misha.

I'm probably best hanging on for the API to be released.

Although...

Given that I authenticate with github, would that not make the re-authing process easier to manage?

itsalljustdata avatar Jun 27 '22 01:06 itsalljustdata

Cheers Misha.

I'm probably best hanging on for the API to be released.

Although...

Given that I authenticate with github, would that not make the re-authing process easier to manage?

@mlsmaycon what do you think?

braginini avatar Jun 27 '22 05:06 braginini

Hi @itsalljustdata, we are looking at some alternative to the JWT to serve as authentication, maybe not using your browser session with GitHub, but rather following they concept with personal access tokens(PAT), stay tuned we should have that sorted out by Q4/2022

mlsmaycon avatar Jul 02 '22 10:07 mlsmaycon

@itsalljustdata we've release support to PATs and Service Users which allow for API calls using tokens. For more details, check out our API docs: https://docs.netbird.io/api

mlsmaycon avatar Jun 16 '23 07:06 mlsmaycon