Skip to content

Commit cfb2c28

Browse files
bring back API pages (#400)
1 parent 36e21f6 commit cfb2c28

File tree

14 files changed

+22191
-0
lines changed

14 files changed

+22191
-0
lines changed

src/pages/ipa/resources/accounts.mdx

Lines changed: 968 additions & 0 deletions
Large diffs are not rendered by default.

src/pages/ipa/resources/dns.mdx

Lines changed: 1878 additions & 0 deletions
Large diffs are not rendered by default.

src/pages/ipa/resources/events.mdx

Lines changed: 563 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 364 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,364 @@
1+
export const title = 'Geo Locations'
2+
3+
4+
5+
## List all country codes {{ tag: 'GET' , label: '/api/locations/countries' }}
6+
7+
<Row>
8+
<Col>
9+
Get list of all country in 2-letter ISO 3166-1 alpha-2 codes
10+
</Col>
11+
12+
<Col sticky>
13+
<CodeGroup title="Request" tag="GET" label="/api/locations/countries">
14+
```bash {{ title: 'cURL' }}
15+
curl -X GET https://api.netbird.io/api/locations/countries \
16+
-H 'Accept: application/json' \
17+
-H 'Authorization: Token <TOKEN>'
18+
```
19+
20+
```js
21+
const axios = require('axios');
22+
23+
let config = {
24+
method: 'get',
25+
maxBodyLength: Infinity,
26+
url: '/api/locations/countries',
27+
headers: {
28+
'Accept': 'application/json',
29+
'Authorization': 'Token <TOKEN>'
30+
}
31+
};
32+
33+
axios(config)
34+
.then((response) => {
35+
console.log(JSON.stringify(response.data));
36+
})
37+
.catch((error) => {
38+
console.log(error);
39+
});
40+
```
41+
42+
```python
43+
import requests
44+
import json
45+
46+
url = "https://api.netbird.io/api/locations/countries"
47+
48+
headers = {
49+
'Accept': 'application/json',
50+
'Authorization': 'Token <TOKEN>'
51+
}
52+
53+
response = requests.request("GET", url, headers=headers)
54+
55+
print(response.text)
56+
```
57+
58+
```go
59+
package main
60+
61+
import (
62+
"fmt"
63+
"strings"
64+
"net/http"
65+
"io/ioutil"
66+
)
67+
68+
func main() {
69+
70+
url := "https://api.netbird.io/api/locations/countries"
71+
method := "GET"
72+
73+
client := &http.Client {
74+
}
75+
req, err := http.NewRequest(method, url, nil)
76+
77+
if err != nil {
78+
fmt.Println(err)
79+
return
80+
{
81+
82+
req.Header.Add("Accept", "application/json")
83+
req.Header.Add("Authorization", "Token <TOKEN>")
84+
85+
res, err := client.Do(req)
86+
if err != nil {
87+
fmt.Println(err)
88+
return
89+
}
90+
defer res.Body.Close()
91+
92+
body, err := ioutil.ReadAll(res.Body)
93+
if err != nil {
94+
fmt.Println(err)
95+
return
96+
}
97+
fmt.Println(string(body))
98+
}
99+
```
100+
101+
```ruby
102+
require "uri"
103+
require "json"
104+
require "net/http"
105+
106+
url = URI("https://api.netbird.io/api/locations/countries")
107+
108+
https = Net::HTTP.new(url.host, url.port)
109+
https.use_ssl = true
110+
111+
request = Net::HTTP::Get.new(url)
112+
request["Accept"] = "application/json"
113+
request["Authorization"] = "Token <TOKEN>"
114+
115+
response = https.request(request)
116+
puts response.read_body
117+
```
118+
119+
```java
120+
OkHttpClient client = new OkHttpClient().newBuilder()
121+
.build();
122+
123+
Request request = new Request.Builder()
124+
.url("https://api.netbird.io/api/locations/countries")
125+
.method("GET")
126+
.addHeader("Accept", "application/json")
127+
.addHeader("Authorization: Token <TOKEN>")
128+
.build();
129+
Response response = client.newCall(request).execute();
130+
```
131+
132+
```php
133+
<?php
134+
135+
$curl = curl_init();
136+
137+
curl_setopt_array($curl, array(
138+
CURLOPT_URL => 'https://api.netbird.io/api/locations/countries',
139+
CURLOPT_RETURNTRANSFER => true,
140+
CURLOPT_ENCODING => '',
141+
CURLOPT_MAXREDIRS => 10,
142+
CURLOPT_TIMEOUT => 0,
143+
CURLOPT_FOLLOWLOCATION => true,
144+
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
145+
CURLOPT_CUSTOMREQUEST => 'GET',
146+
CURLOPT_HTTPHEADER => array(
147+
'Accept: application/json',
148+
'Authorization: Token <TOKEN>'
149+
),
150+
));
151+
152+
$response = curl_exec($curl);
153+
154+
curl_close($curl);
155+
echo $response;
156+
```
157+
158+
</CodeGroup>
159+
160+
161+
<CodeGroup title="Response">
162+
```json {{ title: 'Example' }}
163+
[
164+
"DE"
165+
]
166+
```
167+
```json {{ title: 'Schema' }}
168+
[
169+
"string"
170+
]
171+
```
172+
</CodeGroup>
173+
174+
175+
</Col>
176+
</Row>
177+
178+
---
179+
180+
181+
## List all city names by country {{ tag: 'GET' , label: '/api/locations/countries/{country}/cities' }}
182+
183+
<Row>
184+
<Col>
185+
Get a list of all English city names for a given country code
186+
187+
### Path Parameters
188+
<Properties>
189+
190+
<Property name="country" type="string" required={true}>
191+
192+
</Property>
193+
</Properties>
194+
</Col>
195+
196+
<Col sticky>
197+
<CodeGroup title="Request" tag="GET" label="/api/locations/countries/{country}/cities">
198+
```bash {{ title: 'cURL' }}
199+
curl -X GET https://api.netbird.io/api/locations/countries/{country}/cities \
200+
-H 'Accept: application/json' \
201+
-H 'Authorization: Token <TOKEN>'
202+
```
203+
204+
```js
205+
const axios = require('axios');
206+
207+
let config = {
208+
method: 'get',
209+
maxBodyLength: Infinity,
210+
url: '/api/locations/countries/{country}/cities',
211+
headers: {
212+
'Accept': 'application/json',
213+
'Authorization': 'Token <TOKEN>'
214+
}
215+
};
216+
217+
axios(config)
218+
.then((response) => {
219+
console.log(JSON.stringify(response.data));
220+
})
221+
.catch((error) => {
222+
console.log(error);
223+
});
224+
```
225+
226+
```python
227+
import requests
228+
import json
229+
230+
url = "https://api.netbird.io/api/locations/countries/{country}/cities"
231+
232+
headers = {
233+
'Accept': 'application/json',
234+
'Authorization': 'Token <TOKEN>'
235+
}
236+
237+
response = requests.request("GET", url, headers=headers)
238+
239+
print(response.text)
240+
```
241+
242+
```go
243+
package main
244+
245+
import (
246+
"fmt"
247+
"strings"
248+
"net/http"
249+
"io/ioutil"
250+
)
251+
252+
func main() {
253+
254+
url := "https://api.netbird.io/api/locations/countries/{country}/cities"
255+
method := "GET"
256+
257+
client := &http.Client {
258+
}
259+
req, err := http.NewRequest(method, url, nil)
260+
261+
if err != nil {
262+
fmt.Println(err)
263+
return
264+
{
265+
266+
req.Header.Add("Accept", "application/json")
267+
req.Header.Add("Authorization", "Token <TOKEN>")
268+
269+
res, err := client.Do(req)
270+
if err != nil {
271+
fmt.Println(err)
272+
return
273+
}
274+
defer res.Body.Close()
275+
276+
body, err := ioutil.ReadAll(res.Body)
277+
if err != nil {
278+
fmt.Println(err)
279+
return
280+
}
281+
fmt.Println(string(body))
282+
}
283+
```
284+
285+
```ruby
286+
require "uri"
287+
require "json"
288+
require "net/http"
289+
290+
url = URI("https://api.netbird.io/api/locations/countries/{country}/cities")
291+
292+
https = Net::HTTP.new(url.host, url.port)
293+
https.use_ssl = true
294+
295+
request = Net::HTTP::Get.new(url)
296+
request["Accept"] = "application/json"
297+
request["Authorization"] = "Token <TOKEN>"
298+
299+
response = https.request(request)
300+
puts response.read_body
301+
```
302+
303+
```java
304+
OkHttpClient client = new OkHttpClient().newBuilder()
305+
.build();
306+
307+
Request request = new Request.Builder()
308+
.url("https://api.netbird.io/api/locations/countries/{country}/cities")
309+
.method("GET")
310+
.addHeader("Accept", "application/json")
311+
.addHeader("Authorization: Token <TOKEN>")
312+
.build();
313+
Response response = client.newCall(request).execute();
314+
```
315+
316+
```php
317+
<?php
318+
319+
$curl = curl_init();
320+
321+
curl_setopt_array($curl, array(
322+
CURLOPT_URL => 'https://api.netbird.io/api/locations/countries/{country}/cities',
323+
CURLOPT_RETURNTRANSFER => true,
324+
CURLOPT_ENCODING => '',
325+
CURLOPT_MAXREDIRS => 10,
326+
CURLOPT_TIMEOUT => 0,
327+
CURLOPT_FOLLOWLOCATION => true,
328+
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
329+
CURLOPT_CUSTOMREQUEST => 'GET',
330+
CURLOPT_HTTPHEADER => array(
331+
'Accept: application/json',
332+
'Authorization: Token <TOKEN>'
333+
),
334+
));
335+
336+
$response = curl_exec($curl);
337+
338+
curl_close($curl);
339+
echo $response;
340+
```
341+
342+
</CodeGroup>
343+
344+
345+
<CodeGroup title="Response">
346+
```json {{ title: 'Example' }}
347+
{
348+
"geoname_id": 2950158,
349+
"city_name": "Berlin"
350+
}
351+
```
352+
```json {{ title: 'Schema' }}
353+
{
354+
"geoname_id": "integer",
355+
"city_name": "string"
356+
}
357+
```
358+
</CodeGroup>
359+
360+
361+
</Col>
362+
</Row>
363+
364+
---

0 commit comments

Comments
 (0)