Create ns_info.html
Browse files- ns_info.html +59 -0
ns_info.html
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="ru">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Получение информации о группе</title>
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
</head>
|
11 |
+
<body>
|
12 |
+
<h1>Получение списка параметров группы</h1>
|
13 |
+
<form id="groupForm">
|
14 |
+
<label for="groupId">Идентификатор группы:</label>
|
15 |
+
<input type="text" id="groupId" name="groupId" required>
|
16 |
+
<br>
|
17 |
+
<label for="apiToken">API Токен:</label>
|
18 |
+
<input type="text" id="apiToken" name="apiToken" required>
|
19 |
+
<br>
|
20 |
+
<button type="submit">Получить список параметров группы</button>
|
21 |
+
</form>
|
22 |
+
<div id="result"></div>
|
23 |
+
|
24 |
+
<script>
|
25 |
+
document.addEventListener('DOMContentLoaded', function() {
|
26 |
+
const groupForm = document.getElementById('groupForm');
|
27 |
+
const resultDiv = document.getElementById('result');
|
28 |
+
groupForm.addEventListener('submit', function(event) {
|
29 |
+
event.preventDefault();
|
30 |
+
const groupId = document.getElementById('groupId').value;
|
31 |
+
const apiToken = document.getElementById('apiToken').value;
|
32 |
+
const url = `https://test-sj-crm-psy-vk.hf.space/api/group/${groupId}/parameters?apiToken=${apiToken}`;
|
33 |
+
fetch(url, {
|
34 |
+
method: 'GET',
|
35 |
+
headers: {
|
36 |
+
'Content-Type': 'application/json'
|
37 |
+
}
|
38 |
+
})
|
39 |
+
.then(response => {
|
40 |
+
if (!response.ok) {
|
41 |
+
throw new Error('Network response was not ok ' + response.statusText);
|
42 |
+
}
|
43 |
+
return response.json();
|
44 |
+
})
|
45 |
+
.then(data => {
|
46 |
+
if (data.error) {
|
47 |
+
resultDiv.innerHTML = `<p style="color: red;">Ошибка: ${data.error}</p>`;
|
48 |
+
} else {
|
49 |
+
resultDiv.innerHTML = `<pre>${JSON.stringify(data, null, 2)}</pre>`;
|
50 |
+
}
|
51 |
+
})
|
52 |
+
.catch(error => {
|
53 |
+
resultDiv.innerHTML = `<p style="color: red;">Ошибка: ${error.message}</p>`;
|
54 |
+
});
|
55 |
+
});
|
56 |
+
});
|
57 |
+
</script>
|
58 |
+
</body>
|
59 |
+
</html>
|