mirror of
https://github.com/netbirdio/docs.git
synced 2026-10-21 04:59:04 +02:00
Update API pages with v0.31.0
This commit is contained in:
@@ -770,9 +770,9 @@ echo $response;
|
|||||||
Setup key type, one-off for single time usage and reusable
|
Setup key type, one-off for single time usage and reusable
|
||||||
|
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="expires_in" type="integer" required={true} min={86400} max={31536000}>
|
<Property name="expires_in" type="integer" required={true} min={0}>
|
||||||
|
|
||||||
Expiration time in seconds
|
Expiration time in seconds, 0 will mean the key never expires
|
||||||
|
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="revoked" type="boolean" required={true}>
|
<Property name="revoked" type="boolean" required={true}>
|
||||||
@@ -1080,3 +1080,167 @@ echo $response;
|
|||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## Delete a Setup Key {{ tag: 'DELETE' , label: '/api/setup-keys/{keyId}' }}
|
||||||
|
|
||||||
|
<Row>
|
||||||
|
<Col>
|
||||||
|
Delete a Setup Key
|
||||||
|
|
||||||
|
#### Path Parameters
|
||||||
|
<Properties>
|
||||||
|
|
||||||
|
<Property name="keyId" type="string" required={true}>
|
||||||
|
The unique identifier of a setup key
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
</Col>
|
||||||
|
|
||||||
|
<Col sticky>
|
||||||
|
<CodeGroup title="Request" tag="DELETE" label="/api/setup-keys/{keyId}">
|
||||||
|
```bash {{ title: 'cURL' }}
|
||||||
|
curl -X DELETE https://api.netbird.io/api/setup-keys/{keyId} \
|
||||||
|
-H 'Authorization: Token <TOKEN>'
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
const axios = require('axios');
|
||||||
|
|
||||||
|
let config = {
|
||||||
|
method: 'delete',
|
||||||
|
maxBodyLength: Infinity,
|
||||||
|
url: '/api/setup-keys/{keyId}',
|
||||||
|
headers: {
|
||||||
|
'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/setup-keys/{keyId}"
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
'Authorization': 'Token <TOKEN>'
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.request("DELETE", url, headers=headers)
|
||||||
|
|
||||||
|
print(response.text)
|
||||||
|
```
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"net/http"
|
||||||
|
"io/ioutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
url := "https://api.netbird.io/api/setup-keys/{keyId}"
|
||||||
|
method := "DELETE"
|
||||||
|
|
||||||
|
client := &http.Client {
|
||||||
|
}
|
||||||
|
req, err := http.NewRequest(method, url, nil)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
{
|
||||||
|
|
||||||
|
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/setup-keys/{keyId}")
|
||||||
|
|
||||||
|
https = Net::HTTP.new(url.host, url.port)
|
||||||
|
https.use_ssl = true
|
||||||
|
|
||||||
|
request = Net::HTTP::Delete.new(url)
|
||||||
|
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/setup-keys/{keyId}")
|
||||||
|
.method("DELETE")
|
||||||
|
.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/setup-keys/{keyId}',
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_ENCODING => '',
|
||||||
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
CURLOPT_TIMEOUT => 0,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
|
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||||
|
CURLOPT_HTTPHEADER => array(
|
||||||
|
'Authorization: Token <TOKEN>'
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
|
||||||
|
curl_close($curl);
|
||||||
|
echo $response;
|
||||||
|
```
|
||||||
|
|
||||||
|
</CodeGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
|
||||||
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user