Files
netbird-docs/docs/api/get-peers.api.mdx
2023-04-26 15:06:59 +02:00

54 lines
10 KiB
Plaintext

---
id: get-peers
title: "List all Peers"
description: "Returns a list of all peers"
sidebar_label: "List all Peers"
hide_title: true
hide_table_of_contents: true
api: {"description":"Returns a list of all peers","tags":["Peers"],"operationId":"getPeers","security":[{"BearerAuth":[]},{"TokenAuth":[]}],"responses":{"200":{"description":"A JSON Array of Peers","content":{"application/json":{"schema":{"type":"array","items":{"allOf":[{"type":"object","properties":{"id":{"description":"Peer ID","type":"string"},"name":{"description":"Peer's hostname","type":"string"}},"required":["id","name"],"title":"PeerMinimum"},{"type":"object","properties":{"ip":{"description":"Peer's IP address","type":"string"},"connected":{"description":"Peer to Management connection status","type":"boolean"},"last_seen":{"description":"Last time peer connected to Netbird's management service","type":"string","format":"date-time"},"os":{"description":"Peer's operating system and version","type":"string"},"version":{"description":"Peer's daemon or cli version","type":"string"},"groups":{"description":"Groups that the peer belongs to","type":"array","items":{"type":"object","properties":{"id":{"description":"Group ID","type":"string"},"name":{"description":"Group Name identifier","type":"string"},"peers_count":{"description":"Count of peers associated to the group","type":"integer"}},"required":["id","name","peers_count"],"title":"GroupMinimum"}},"ssh_enabled":{"description":"Indicates whether SSH server is enabled on this peer","type":"boolean"},"user_id":{"description":"User ID of the user that enrolled this peer","type":"string"},"hostname":{"description":"Hostname of the machine","type":"string"},"ui_version":{"description":"Peer's desktop UI version","type":"string"},"dns_label":{"description":"Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud","type":"string"},"login_expiration_enabled":{"description":"Indicates whether peer login expiration has been enabled or not","type":"boolean"},"login_expired":{"description":"Indicates whether peer's login expired or not","type":"boolean"},"last_login":{"description":"Last time this peer performed log in (authentication). E.g., user authenticated.","type":"string","format":"date-time"}},"required":["ip","connected","last_seen","os","version","groups","ssh_enabled","hostname","dns_label","login_expiration_enabled","login_expired","last_login"]}],"title":"Peer"}}}}},"400":{"description":"Bad Request","content":{}},"401":{"description":"Requires authentication","content":{}},"403":{"description":"Forbidden","content":{}},"500":{"description":"Internal Server Error","content":{}}},"method":"get","path":"/api/peers","servers":[{"url":"https://netbird.io","description":"Default server"}],"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"TokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Prefix the value with \\\"Token\\\" to indicate the custom authorization type"}},"info":{"title":"NetBird REST API","description":"API to manipulate groups, rules, policies and retrieve information about peers and users","version":"0.0.1"},"postman":{"name":"List all Peers","description":{"content":"Returns a list of all peers","type":"text/plain"},"url":{"path":["api","peers"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Accept","value":"application/json"}],"method":"GET","auth":{"type":"bearer","bearer":[{"type":"any","value":"<Bearer Token>","key":"token"}]}}}
sidebar_class_name: "get api-method"
info_path: api/netbird-rest-api
custom_edit_url: null
---
import ApiTabs from "@theme/ApiTabs";
import MimeTabs from "@theme/MimeTabs";
import ParamsItem from "@theme/ParamsItem";
import ResponseSamples from "@theme/ResponseSamples";
import SchemaItem from "@theme/SchemaItem";
import SchemaTabs from "@theme/SchemaTabs";
import DiscriminatorTabs from "@theme/DiscriminatorTabs";
import TabItem from "@theme/TabItem";
## List all Peers
Returns a list of all peers
<div><ApiTabs><TabItem label={"200"} value={"200"}><div>
A JSON Array of Peers
</div><div><MimeTabs schemaType={"response"}><TabItem label={"application/json"} value={"application/json"}><SchemaTabs><TabItem label={"Schema"} value={"Schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Schema</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}></div><ul style={{"marginLeft":"1rem"}}><li><div style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem","paddingBottom":".5rem"}}>Array [</div></li><SchemaItem collapsible={false} name={"id"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Peer ID","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Peer's hostname","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"ip"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Peer's IP address","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"connected"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Peer to Management connection status","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"last_seen"} required={true} schemaName={"date-time"} qualifierMessage={undefined} schema={{"description":"Last time peer connected to Netbird's management service","type":"string","format":"date-time"}}></SchemaItem><SchemaItem collapsible={false} name={"os"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Peer's operating system and version","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"version"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Peer's daemon or cli version","type":"string"}}></SchemaItem><SchemaItem collapsible={true} className={"schemaItem"}><details style={{}}><summary style={{}}><strong>groups</strong><span style={{"opacity":"0.6"}}> object[]</span><strong style={{"fontSize":"var(--ifm-code-font-size)","color":"var(--openapi-required)"}}> required</strong></summary><div style={{"marginLeft":"1rem"}}><div style={{"marginTop":".5rem","marginBottom":".5rem"}}>
Groups that the peer belongs to
</div><li><div style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem","paddingBottom":".5rem"}}>Array [</div></li><SchemaItem collapsible={false} name={"id"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Group ID","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Group Name identifier","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"peers_count"} required={true} schemaName={"integer"} qualifierMessage={undefined} schema={{"description":"Count of peers associated to the group","type":"integer"}}></SchemaItem><li><div style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem"}}>]</div></li></div></details></SchemaItem><SchemaItem collapsible={false} name={"ssh_enabled"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Indicates whether SSH server is enabled on this peer","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"user_id"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"User ID of the user that enrolled this peer","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"hostname"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Hostname of the machine","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"ui_version"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Peer's desktop UI version","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"dns_label"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"login_expiration_enabled"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Indicates whether peer login expiration has been enabled or not","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"login_expired"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Indicates whether peer's login expired or not","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"last_login"} required={true} schemaName={"date-time"} qualifierMessage={undefined} schema={{"description":"Last time this peer performed log in (authentication). E.g., user authenticated.","type":"string","format":"date-time"}}></SchemaItem><li><div style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem"}}>]</div></li></ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"[\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"ip\": \"string\",\n \"connected\": true,\n \"last_seen\": \"2023-04-26T12:12:56.623Z\",\n \"os\": \"string\",\n \"version\": \"string\",\n \"groups\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"peers_count\": 0\n }\n ],\n \"ssh_enabled\": true,\n \"user_id\": \"string\",\n \"hostname\": \"string\",\n \"ui_version\": \"string\",\n \"dns_label\": \"string\",\n \"login_expiration_enabled\": true,\n \"login_expired\": true,\n \"last_login\": \"2023-04-26T12:12:56.623Z\"\n }\n]"} language={"json"}></ResponseSamples></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem><TabItem label={"400"} value={"400"}><div>
Bad Request
</div><div></div></TabItem><TabItem label={"401"} value={"401"}><div>
Requires authentication
</div><div></div></TabItem><TabItem label={"403"} value={"403"}><div>
Forbidden
</div><div></div></TabItem><TabItem label={"500"} value={"500"}><div>
Internal Server Error
</div><div></div></TabItem></ApiTabs></div>