mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-18 08:26:35 +00:00
841 lines
17 KiB
Plaintext
841 lines
17 KiB
Plaintext
import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/components/mdx";
|
|
|
|
<HeroPattern />
|
|
|
|
export const title = 'Tokens'
|
|
|
|
|
|
|
|
## List all Tokens {{ tag: 'GET' , label: '/api/users/{userId}/tokens' }}
|
|
|
|
<Row>
|
|
<Col>
|
|
Returns a list of all tokens for a user
|
|
|
|
#### Path Parameters
|
|
<Properties>
|
|
|
|
<Property name="userId" type="string" required={true}>
|
|
The unique identifier of a user
|
|
</Property>
|
|
</Properties>
|
|
</Col>
|
|
|
|
<Col sticky>
|
|
<CodeGroup title="Request" tag="GET" label="/api/users/{userId}/tokens">
|
|
```bash {{ title: 'cURL' }}
|
|
curl -X GET https://api.netbird.io/api/users/{userId}/tokens \
|
|
-H 'Accept: application/json' \
|
|
-H 'Authorization: Token <TOKEN>'
|
|
```
|
|
|
|
```js
|
|
const axios = require('axios');
|
|
|
|
let config = {
|
|
method: 'get',
|
|
maxBodyLength: Infinity,
|
|
url: '/api/users/{userId}/tokens',
|
|
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/users/{userId}/tokens"
|
|
|
|
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/users/{userId}/tokens"
|
|
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/users/{userId}/tokens")
|
|
|
|
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/users/{userId}/tokens")
|
|
.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/users/{userId}/tokens',
|
|
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": "ch8i54g6lnn4g9hqv7n0",
|
|
"name": "My first token",
|
|
"expiration_date": "2023-05-05T14:38:28.977616Z",
|
|
"created_by": "google-oauth2|277474792786460067937",
|
|
"created_at": "2023-05-02T14:48:20.465209Z",
|
|
"last_used": "2023-05-04T12:45:25.9723616Z"
|
|
}
|
|
]
|
|
```
|
|
```json {{ title: 'Schema' }}
|
|
[
|
|
{
|
|
"id": "string",
|
|
"name": "string",
|
|
"expiration_date": "string",
|
|
"created_by": "string",
|
|
"created_at": "string",
|
|
"last_used": "string"
|
|
}
|
|
]
|
|
```
|
|
</CodeGroup>
|
|
|
|
|
|
|
|
|
|
|
|
</Col>
|
|
</Row>
|
|
|
|
---
|
|
|
|
|
|
## Create a Token {{ tag: 'POST' , label: '/api/users/{userId}/tokens' }}
|
|
|
|
<Row>
|
|
<Col>
|
|
Create a new token for a user
|
|
|
|
#### Path Parameters
|
|
<Properties>
|
|
|
|
<Property name="userId" type="string" required={true}>
|
|
The unique identifier of a user
|
|
</Property>
|
|
</Properties>
|
|
|
|
#### Request-Body Parameters
|
|
<Properties>
|
|
|
|
<Property name="name" type="string" required={true}
|
|
|
|
|
|
>
|
|
Name of the token
|
|
</Property>
|
|
|
|
<Property name="expires_in" type="integer" required={true}
|
|
|
|
|
|
min={1}
|
|
|
|
|
|
max={365}
|
|
>
|
|
Expiration in days
|
|
</Property>
|
|
</Properties>
|
|
</Col>
|
|
|
|
<Col sticky>
|
|
<CodeGroup title="Request" tag="POST" label="/api/users/{userId}/tokens">
|
|
```bash {{ title: 'cURL' }}
|
|
curl -X POST https://api.netbird.io/api/users/{userId}/tokens \
|
|
-H 'Accept: application/json' \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Authorization: Token <TOKEN>' \
|
|
--data-raw '{
|
|
"name": "My first token",
|
|
"expires_in": 30
|
|
}'
|
|
```
|
|
|
|
```js
|
|
const axios = require('axios');
|
|
let data = JSON.stringify({
|
|
"name": "My first token",
|
|
"expires_in": 30
|
|
});
|
|
let config = {
|
|
method: 'post',
|
|
maxBodyLength: Infinity,
|
|
url: '/api/users/{userId}/tokens',
|
|
headers: {
|
|
'Accept': 'application/json',
|
|
'Content-Type': 'application/json',
|
|
'Authorization': 'Token <TOKEN>'
|
|
},
|
|
data : data
|
|
};
|
|
|
|
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/users/{userId}/tokens"
|
|
payload = json.dumps({
|
|
"name": "My first token",
|
|
"expires_in": 30
|
|
})
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Accept': 'application/json',
|
|
'Authorization': 'Token <TOKEN>'
|
|
}
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
print(response.text)
|
|
```
|
|
|
|
```go
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"net/http"
|
|
"io/ioutil"
|
|
)
|
|
|
|
func main() {
|
|
|
|
url := "https://api.netbird.io/api/users/{userId}/tokens"
|
|
method := "POST"
|
|
|
|
payload := strings.NewReader(`{
|
|
"name": "My first token",
|
|
"expires_in": 30
|
|
}`)
|
|
client := &http.Client {
|
|
}
|
|
req, err := http.NewRequest(method, url, payload)
|
|
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return
|
|
{
|
|
|
|
req.Header.Add("Content-Type", "application/json")
|
|
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/users/{userId}/tokens")
|
|
|
|
https = Net::HTTP.new(url.host, url.port)
|
|
https.use_ssl = true
|
|
|
|
request = Net::HTTP::Post.new(url)
|
|
request["Content-Type"] = "application/json"
|
|
request["Accept"] = "application/json"
|
|
request["Authorization"] = "Token <TOKEN>"
|
|
|
|
request.body = JSON.dump({
|
|
"name": "My first token",
|
|
"expires_in": 30
|
|
})
|
|
response = https.request(request)
|
|
puts response.read_body
|
|
```
|
|
|
|
```java
|
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
|
.build();
|
|
MediaType mediaType = MediaType.parse("application/json");
|
|
RequestBody body = RequestBody.create(mediaType, '{
|
|
"name": "My first token",
|
|
"expires_in": 30
|
|
}');
|
|
Request request = new Request.Builder()
|
|
.url("https://api.netbird.io/api/users/{userId}/tokens")
|
|
.method("POST", body)
|
|
.addHeader("Content-Type", "application/json")
|
|
.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/users/{userId}/tokens',
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_ENCODING => '',
|
|
CURLOPT_MAXREDIRS => 10,
|
|
CURLOPT_TIMEOUT => 0,
|
|
CURLOPT_FOLLOWLOCATION => true,
|
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
|
CURLOPT_POSTFIELDS => '{
|
|
"name": "My first token",
|
|
"expires_in": 30
|
|
}',
|
|
CURLOPT_HTTPHEADER => array(
|
|
'Content-Type: application/json',
|
|
'Accept: application/json',
|
|
'Authorization: Token <TOKEN>'
|
|
),
|
|
));
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
curl_close($curl);
|
|
echo $response;
|
|
```
|
|
|
|
</CodeGroup>
|
|
|
|
|
|
|
|
<CodeGroup title="Response">
|
|
```json {{ title: 'Example' }}
|
|
{
|
|
"plain_token": "2023-05-02T14:48:20.465209Z",
|
|
"personal_access_token": {
|
|
"id": "ch8i54g6lnn4g9hqv7n0",
|
|
"name": "My first token",
|
|
"expiration_date": "2023-05-05T14:38:28.977616Z",
|
|
"created_by": "google-oauth2|277474792786460067937",
|
|
"created_at": "2023-05-02T14:48:20.465209Z",
|
|
"last_used": "2023-05-04T12:45:25.9723616Z"
|
|
}
|
|
}
|
|
```
|
|
```json {{ title: 'Schema' }}
|
|
{
|
|
"plain_token": "string",
|
|
"personal_access_token": {
|
|
"id": "string",
|
|
"name": "string",
|
|
"expiration_date": "string",
|
|
"created_by": "string",
|
|
"created_at": "string",
|
|
"last_used": "string"
|
|
}
|
|
}
|
|
```
|
|
</CodeGroup>
|
|
|
|
|
|
|
|
|
|
|
|
</Col>
|
|
</Row>
|
|
|
|
---
|
|
|
|
|
|
## Retrieve a Token {{ tag: 'GET' , label: '/api/users/{userId}/tokens/{tokenId}' }}
|
|
|
|
<Row>
|
|
<Col>
|
|
Returns a specific token for a user
|
|
|
|
#### Path Parameters
|
|
<Properties>
|
|
|
|
<Property name="userId" type="string" required={true}>
|
|
The unique identifier of a user
|
|
</Property>
|
|
|
|
<Property name="tokenId" type="string" required={true}>
|
|
The unique identifier of a token
|
|
</Property>
|
|
</Properties>
|
|
</Col>
|
|
|
|
<Col sticky>
|
|
<CodeGroup title="Request" tag="GET" label="/api/users/{userId}/tokens/{tokenId}">
|
|
```bash {{ title: 'cURL' }}
|
|
curl -X GET https://api.netbird.io/api/users/{userId}/tokens/{tokenId} \
|
|
-H 'Accept: application/json' \
|
|
-H 'Authorization: Token <TOKEN>'
|
|
```
|
|
|
|
```js
|
|
const axios = require('axios');
|
|
|
|
let config = {
|
|
method: 'get',
|
|
maxBodyLength: Infinity,
|
|
url: '/api/users/{userId}/tokens/{tokenId}',
|
|
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/users/{userId}/tokens/{tokenId}"
|
|
|
|
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/users/{userId}/tokens/{tokenId}"
|
|
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/users/{userId}/tokens/{tokenId}")
|
|
|
|
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/users/{userId}/tokens/{tokenId}")
|
|
.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/users/{userId}/tokens/{tokenId}',
|
|
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": "ch8i54g6lnn4g9hqv7n0",
|
|
"name": "My first token",
|
|
"expiration_date": "2023-05-05T14:38:28.977616Z",
|
|
"created_by": "google-oauth2|277474792786460067937",
|
|
"created_at": "2023-05-02T14:48:20.465209Z",
|
|
"last_used": "2023-05-04T12:45:25.9723616Z"
|
|
}
|
|
```
|
|
```json {{ title: 'Schema' }}
|
|
{
|
|
"id": "string",
|
|
"name": "string",
|
|
"expiration_date": "string",
|
|
"created_by": "string",
|
|
"created_at": "string",
|
|
"last_used": "string"
|
|
}
|
|
```
|
|
</CodeGroup>
|
|
|
|
|
|
|
|
|
|
|
|
</Col>
|
|
</Row>
|
|
|
|
---
|
|
|
|
|
|
## Delete a Token {{ tag: 'DELETE' , label: '/api/users/{userId}/tokens/{tokenId}' }}
|
|
|
|
<Row>
|
|
<Col>
|
|
Delete a token for a user
|
|
|
|
#### Path Parameters
|
|
<Properties>
|
|
|
|
<Property name="userId" type="string" required={true}>
|
|
The unique identifier of a user
|
|
</Property>
|
|
|
|
<Property name="tokenId" type="string" required={true}>
|
|
The unique identifier of a token
|
|
</Property>
|
|
</Properties>
|
|
</Col>
|
|
|
|
<Col sticky>
|
|
<CodeGroup title="Request" tag="DELETE" label="/api/users/{userId}/tokens/{tokenId}">
|
|
```bash {{ title: 'cURL' }}
|
|
curl -X DELETE https://api.netbird.io/api/users/{userId}/tokens/{tokenId} \
|
|
-H 'Authorization: Token <TOKEN>'
|
|
```
|
|
|
|
```js
|
|
const axios = require('axios');
|
|
|
|
let config = {
|
|
method: 'delete',
|
|
maxBodyLength: Infinity,
|
|
url: '/api/users/{userId}/tokens/{tokenId}',
|
|
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/users/{userId}/tokens/{tokenId}"
|
|
|
|
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/users/{userId}/tokens/{tokenId}"
|
|
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/users/{userId}/tokens/{tokenId}")
|
|
|
|
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/users/{userId}/tokens/{tokenId}")
|
|
.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/users/{userId}/tokens/{tokenId}',
|
|
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>
|
|
|
|
---
|