Cihaz envanterinizi API üzerinden yönetmeye ilişkin kapsamlı bilgileri, cihaz yapılandırmalarının izlenmesi ve güncellenmesine dair detayları aşağıda bulabilirsiniz.
Cihaz Listesi Çekme
GET https://api.berqnetservices.com/devices
Request Parametreleri
| Ad | Tür | Açıklama |
|---|---|---|
| page | number | Sonuçların belirli bir bölümüne erişmek için sayfa numarasını belirtin |
| order | string | Sonuçları artan veya azalan sırada sıralayın |
| filter_name | string | Belirli cihazları bulmak için isme göre arama yapın |
| limit | number | İstek başına döndürülen sonuç sayısına sınır koyun |
| sort | string | Sonuçları izin verilen alanlara göre sıralayın: name, local_ip, os.type, online status, last_seen_at, network_interfaces.mac veya created_at |
Response:
200 Cihazlar Başarıyla Getirildi
{
"date": "2024-04-18T21:06:38.569Z",
"status": true,
"messages": [],
"results": {
"total": 41,
"entries": [
{
"site_id": 848,
"node_id": 1633,
"user_id": null,
"name": "John's Laptop",
"alias": "John's Laptop",
"os": {
"type": "windows",
"version": ""
},
"public_ip": null,
"local_ip": "192.168.249.8",
"private_interface_id": 2339,
"uuid": null,
"epp_device_identifiers": {
"sentinelone": null,
"bitdefender": null,
"microsoft_defender": null
},
"network_interfaces": [
{
"mac": "b0:a4:60:76:bd:c1",
"inet": [
null
]
}
],
"is_ssl_inspection_enabled": false,
"tunnel_configuration": {},
"is_online": false,
"last_seen_at": "2023-10-18T08:53:02.000Z",
"created_at": "2023-10-18T07:25:36.000Z",
"updated_at": "2023-10-18T08:53:02.000Z",
"sdn_id": 183,
"id": "73ibf44BYIdzK88IGmtp",
"tags": []
}
]
}
}
400 Geçersiz Parametreler
{
"date": "2024-04-18T21:08:12.946Z",
"status": false,
"messages": [
{
"code": "BadRequestException",
"description": "Sort must be specified using one of the following values: name, local_ip, os.type, online, last_seen_at, network_interfaces.mac, or created_at."
}
],
"results": []
}
Bu metodu nasıl çağırabileceğinize ilişkin bir örnekler:
curl
curl --location '<https://api.berqnetservices.com/devices?page=1&order=asc&search=MyDevice&limit=1&sort=name3>' \ --header 'Authorization: Bearer YOUR_TOKEN'
NodeJS
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: '<https://api.berqnetservices.com/devices?page=1&order=asc&search=test&limit=1&sort=name3>',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Go
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "<https://api.berqnetservices.com/devices?page=1&order=asc&search=test&limit=1&sort=name3>"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer YOUR_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))
}
Cihaz Güncelleme
PUT <https://api.berqnetservices.com/devices/:id>
Request Parametreleri
| Ad | Tür | Açıklama |
|---|---|---|
| name | string | Cihazın güncellenmiş adı |
| tags | array | Cihaza atanmış güncellenmiş etiket listesi |
| alias | string | Cihazın güncellenmiş takma adı |
Response:
200 Cihaz Başarıyla Güncellendi
{
"date": "2024-04-18T21:18:29.977Z",
"status": true,
"messages": [],
"results": {
"site_id": 848,
"node_id": 1633,
"user_id": null,
"name": "Richard",
"alias": "Richard's iPhone",
"os": {
"type": "ios 15.1.0",
"version": null
},
"public_ip": null,
"local_ip": "192.168.2.53",
"private_interface_id": "2093",
"uuid": null,
"epp_device_identifiers": {
"sentinelone": null,
"bitdefender": null,
"microsoft_defender": null
},
"network_interfaces": [
{
"inet": [
"192.168.2.53"
],
"mac": "26:b1:0a:6d:c9:78"
}
],
"is_ssl_inspection_enabled": true,
"tunnel_configuration": {},
"is_online": false,
"last_seen_at": "2023-05-30T08:21:17.000Z",
"created_at": "2023-05-30T05:12:10.000Z",
"updated_at": "2024-04-18T21:18:29.628Z",
"sdn_id": 183,
"id": "bnii4I0BgdRKipEj9t7A",
"allowed_sites": [
848
],
"tags": [
"hWPsHY4BKyic2m5h68XM",
"0Hif4I0BgdRKipEjFN2n",
"lp6mcIsBT1DQPYTabiYd"
],
"static_ips": [
{
"ip": "192.168.249.4/32",
"site_id": 848,
"private_interface_id": 2601
}
]
}
}
400 Geçersiz Parametreler
{
"date": "2024-04-18T21:20:51.734Z",
"status": false,
"messages": [
{
"code": "BadRequestException",
"description": "Name must be a string"
}
],
"results": []
}
Bu metodu nasıl çağırabileceğinize ilişkin bir örnekler:
curl
curl --location --request PUT '<https://api.berqnetservices.com/devices/bnii4I0BgdRKipEj9t7A>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--data '{
"name": "Test",
"tags": [
"hWPsHY4BKyic2m5h68XM",
"0Hif4I0BgdRKipEjFN2n",
"lp6mcIsBT1DQPYTabiYd"
]
}'
NodeJS
const axios = require('axios');
let data = JSON.stringify({
"name": "Test",
"tags": [
"hWPsHY4BKyic2m5h68XM",
"0Hif4I0BgdRKipEjFN2n",
"lp6mcIsBT1DQPYTabiYd"
]
});
let config = {
method: 'put',
maxBodyLength: Infinity,
url: '<https://api.berqnetservices.com/devices/bnii4I0BgdRKipEj9t7A>',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN',
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "<https://api.berqnetservices.com/devices/bnii4I0BgdRKipEj9t7A>"
method := "PUT"
payload := strings.NewReader(`{
"name": "Test",
"tags": [
"hWPsHY4BKyic2m5h68XM",
"0Hif4I0BgdRKipEjFN2n",
"lp6mcIsBT1DQPYTabiYd"
]
}`)
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("Authorization", "Bearer YOUR_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))
}
0 yorum
Yorum yazmak için lütfen oturum açın: oturum aç.