دریافت اطلاعات داشبورد
مولفه ها
- کلید های دسترسی (اجباری)
- CURL
- Node.js
- Python
- GO
- PHP
curl -X 'GET' \
'https://api.vidprotect.ir/v1/teacher/dashboard' \
-H 'accept: application/json' \
-H 'api_key: your_api_key' \
-H 'secret_key: your_secret_key'
const superagent = require('superagent');
superagent('https://api.vidprotect.ir/v1/teacher/dashboard')
.set('api_key', 'your_api_key')
.set('secret_key', 'your_secret_key')
.then(data => console.log(data.body))
.catch(console.log);
import requests
url = 'https://api.vidprotect.ir/v1/teacher/dashboard'
headers = {
'api_key': 'your_api_key',
'secret_key': 'your_secret_key'
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
data = response.json()
print(data)
except requests.exceptions.RequestException as e:
print(e)
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.vidprotect.ir/v1/teacher/dashboard"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("api_key", "your_api_key")
req.Header.Set("secret_key", "your_secret_key")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error making request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
fmt.Println(string(body))
}
<?php
$url = 'https://api.vidprotect.ir/v1/teacher/dashboard';
$api_key = 'your_api_key';
$secret_key = 'your_secret_key';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'api_key: ' . $api_key,
'secret_key: ' . $secret_key
));
$response = curl_exec($ch);
if ($response === false) {
echo 'Error: ' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>