Skip to content

Commit

Permalink
Update API pages with v0.29.2
Browse files Browse the repository at this point in the history
  • Loading branch information
netbirddev committed Sep 12, 2024
1 parent 566de95 commit 8799762
Showing 1 changed file with 212 additions and 40 deletions.
252 changes: 212 additions & 40 deletions src/pages/ipa/resources/peers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -438,16 +438,7 @@ echo $response;
"approval_required": true,
"country_code": "DE",
"city_name": "Berlin",
"serial_number": "C02XJ0J0JGH7",
"accessible_peers": [
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1",
"ip": "10.64.0.1",
"dns_label": "stage-host-1.netbird.cloud",
"user_id": "google-oauth2|277474792786460067937"
}
]
"serial_number": "C02XJ0J0JGH7"
}
```
```json {{ title: 'Schema' }}
Expand Down Expand Up @@ -481,16 +472,7 @@ echo $response;
"approval_required": "boolean",
"country_code": "string",
"city_name": "string",
"serial_number": "string",
"accessible_peers": [
{
"id": "string",
"name": "string",
"ip": "string",
"dns_label": "string",
"user_id": "string"
}
]
"serial_number": "string"
}
```
</CodeGroup>
Expand Down Expand Up @@ -772,16 +754,7 @@ echo $response;
"approval_required": true,
"country_code": "DE",
"city_name": "Berlin",
"serial_number": "C02XJ0J0JGH7",
"accessible_peers": [
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1",
"ip": "10.64.0.1",
"dns_label": "stage-host-1.netbird.cloud",
"user_id": "google-oauth2|277474792786460067937"
}
]
"serial_number": "C02XJ0J0JGH7"
}
```
```json {{ title: 'Schema' }}
Expand Down Expand Up @@ -815,16 +788,7 @@ echo $response;
"approval_required": "boolean",
"country_code": "string",
"city_name": "string",
"serial_number": "string",
"accessible_peers": [
{
"id": "string",
"name": "string",
"ip": "string",
"dns_label": "string",
"user_id": "string"
}
]
"serial_number": "string"
}
```
</CodeGroup>
Expand Down Expand Up @@ -998,3 +962,211 @@ echo $response;
</Row>
---
## List accessible Peers {{ tag: 'GET' , label: '/api/peers/{peerId}/accessible-peers' }}
<Row>
<Col>
Returns a list of peers that the specified peer can connect to within the network.
#### Path Parameters
<Properties>
<Property name="peerId" type="string" required={true}>
The unique identifier of a peer
</Property>
</Properties>
</Col>
<Col sticky>
<CodeGroup title="Request" tag="GET" label="/api/peers/{peerId}/accessible-peers">
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/peers/{peerId}/accessible-peers \
-H 'Accept: application/json' \
-H 'Authorization: Token <TOKEN>'
```
```js
const axios = require('axios');

let config = {
method: 'get',
maxBodyLength: Infinity,
url: '/api/peers/{peerId}/accessible-peers',
headers: {
'Accept': 'application/json',
'Authorization': 'Token <TOKEN>'
}
};

axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
```
```python
import requests
import json

url = "https://api.netbird.io/api/peers/{peerId}/accessible-peers"

headers = {
'Accept': 'application/json',
'Authorization': 'Token <TOKEN>'
}

response = requests.request("GET", url, headers=headers)

print(response.text)
```
```go
package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.netbird.io/api/peers/{peerId}/accessible-peers"
method := "GET"

client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)

if err != nil {
fmt.Println(err)
return
{

req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Token <TOKEN>")

res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```
```ruby
require "uri"
require "json"
require "net/http"

url = URI("https://api.netbird.io/api/peers/{peerId}/accessible-peers")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"
request["Authorization"] = "Token <TOKEN>"

response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();

Request request = new Request.Builder()
.url("https://api.netbird.io/api/peers/{peerId}/accessible-peers")
.method("GET")
.addHeader("Accept", "application/json")
.addHeader("Authorization: Token <TOKEN>")
.build();
Response response = client.newCall(request).execute();
```
```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.netbird.io/api/peers/{peerId}/accessible-peers',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: Token <TOKEN>'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```
</CodeGroup>
<CodeGroup title="Response">
```json {{ title: 'Example' }}
[
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1",
"ip": "10.64.0.1",
"dns_label": "stage-host-1.netbird.cloud",
"user_id": "google-oauth2|277474792786460067937",
"os": "linux",
"country_code": "DE",
"city_name": "Berlin",
"geoname_id": 2643743,
"connected": true,
"last_seen": "2023-05-05T10:05:26.420578Z"
}
]
```
```json {{ title: 'Schema' }}
[
{
"id": "string",
"name": "string",
"ip": "string",
"dns_label": "string",
"user_id": "string",
"os": "string",
"country_code": "string",
"city_name": "string",
"geoname_id": "integer",
"connected": "boolean",
"last_seen": "string"
}
]
```
</CodeGroup>
</Col>
</Row>
---

0 comments on commit 8799762

Please sign in to comment.