edu-dis-labs-private/test/index.html

198 lines
36 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Тестування працездатності системи | Xpertise</title>
<meta name="generator" content="VuePress 1.8.2">
<link rel="icon" href="/edu-dis-labs-private/favicon.ico">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<meta name="description" content="Лабораторні роботи з дисципліни "Організація баз даних"">
<link rel="preload" href="/edu-dis-labs-private/assets/css/0.styles.3d48b42c.css" as="style"><link rel="preload" href="/edu-dis-labs-private/assets/js/app.183fc2e4.js" as="script"><link rel="preload" href="/edu-dis-labs-private/assets/js/2.11435098.js" as="script"><link rel="preload" href="/edu-dis-labs-private/assets/js/25.cc4d9332.js" as="script"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/10.e50a5206.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/11.29ee89f8.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/12.0b4fa948.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/13.6b4a3ce8.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/14.2545c1ad.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/15.0aee5be2.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/16.13799d8c.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/17.b51d0d04.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/18.ddf9d35b.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/19.85d5c25e.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/20.45f25853.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/21.c178c591.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/22.7414ef83.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/23.0457f9d4.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/24.92136d00.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/26.a9d31514.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/27.678360d8.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/28.01bbdb4a.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/3.3d08d86c.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/4.4c193c95.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/5.dea68fdd.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/6.6d8c3d51.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/7.9617083c.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/8.53a1b2bd.js"><link rel="prefetch" href="/edu-dis-labs-private/assets/js/9.1882ecda.js">
<link rel="stylesheet" href="/edu-dis-labs-private/assets/css/0.styles.3d48b42c.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/edu-dis-labs-private/" class="home-link router-link-active"><!----> <span class="site-name">Xpertise</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/edu-dis-labs-private/" class="nav-link">
Початок
</a></div> <a href="http://139.162.162.130:3000/hasslesstech/edu-dis-labs-private" target="_blank" rel="noopener noreferrer" class="repo-link">
Gitea
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/edu-dis-labs-private/" class="nav-link">
Початок
</a></div> <a href="http://139.162.162.130:3000/hasslesstech/edu-dis-labs-private" target="_blank" rel="noopener noreferrer" class="repo-link">
Gitea
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav> <ul class="sidebar-links"><li><a href="/edu-dis-labs-private/intro/" class="sidebar-link">Вступ</a></li><li><section class="sidebar-group collapsable depth-0"><a href="/edu-dis-labs-private/requirements/" class="sidebar-heading clickable"><span>Розроблення вимог до системи</span> <span class="arrow right"></span></a> <!----></section></li><li><a href="/edu-dis-labs-private/use-cases/" class="sidebar-link">Розроблення вимог до функціональности системи</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/use-cases/#загальна-схема" class="sidebar-link">Загальна схема</a></li><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/use-cases/#схеми-використання-для-окремих-діячів" class="sidebar-link">Схеми використання для окремих діячів</a></li><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/use-cases/#сценаріі-використання" class="sidebar-link">Сценарії використання</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/use-cases/#для-гостя" class="sidebar-link">Для гостя</a></li><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/use-cases/#для-зареєстрованого-користувача" class="sidebar-link">Для зареєстрованого користувача</a></li></ul></li></ul></li><li><a href="/edu-dis-labs-private/design/" class="sidebar-link">Проєктування архітектури системи</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/design/#be-модель" class="sidebar-link">BE модель</a></li><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/design/#er-модель" class="sidebar-link">ER-модель</a></li><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/design/#реляціина-схема" class="sidebar-link">Реляційна схема</a></li></ul></li><li><a href="/edu-dis-labs-private/software/" class="sidebar-link">Реалізація інформаційного та програмного забезпечення</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/software/#sql-скрипт-для-створення-та-початкового-наповнення-бази-даних" class="sidebar-link">SQL-скрипт для створення та початкового наповнення бази даних</a></li><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/software/#restfull-сервіс-для-керування-опитуваннями" class="sidebar-link">RESTfull-сервіс для керування опитуваннями</a></li></ul></li><li><a href="/edu-dis-labs-private/test/" aria-current="page" class="active sidebar-link">Тестування працездатності системи</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/test/#передумови" class="sidebar-link">Передумови</a></li><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/test/#тестування-компонентів" class="sidebar-link">Тестування компонентів</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/edu-dis-labs-private/test/
<span class="token builtin class-name">source</span> bin/activate.fish
pip3 <span class="token function">install</span> flask mariadb
</code></pre></div><ol start="2"><li>Запуск сервера:</li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>flask --app server run
</code></pre></div><h2 id="тестування-компонентів"><a href="#тестування-компонентів" class="header-anchor">#</a> Тестування компонентів</h2> <p>Система має два варіанти передачі індексів: у рядку шляху або в тілі запиту. Перевіримо, як працюють обидва варіанти.</p> <h3 id="api-survey"><a href="#api-survey" class="header-anchor">#</a> /api/survey</h3> <p>Цей шлях дозволяє використовувати всі 4 HTTP-методи, що використовуються в домовленості REST (GET, POST, PUT, DELETE).
Протестуємо кожен з них на практичному прикладі:</p> <pre style="color:#ffffff;font-size:10pt;"><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/demo</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-s</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey</span><span style="color:dimgray;"></span> <span style="color:lime;">|</span><span style="color:dimgray;"></span> <span style="color:#3333FF;">jq</span><span style="color:dimgray;"></span> <span style="color:aqua;">.</span>
<span style="font-weight:bold;">[
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 1&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>10<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">,
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>4<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 2&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>5<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">
]</span>
<span style="color:dimgray;"></span><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/demo</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-X</span><span style="color:dimgray;"></span> <span style="color:aqua;">POST</span><span style="color:dimgray;"></span> <span style="color:aqua;">-d</span><span style="color:dimgray;"></span> <span style="color:yellow;">'{&quot;isPaused&quot;: false, &quot;isNamed&quot;: true, &quot;name&quot;: &quot;Test 3&quot;, &quot;duration&quot;: &quot;1w&quot;, &quot;account_id&quot;: 2}'</span><span style="color:dimgray;"></span> <span style="color:aqua;">--header</span><span style="color:dimgray;"></span> <span style="color:yellow;">&quot;Content-Type: application/json&quot;</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey</span>
{&quot;success&quot;: true}
<span style="color:dimgray;"></span><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/demo</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-s</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey</span><span style="color:dimgray;"></span> <span style="color:lime;">|</span><span style="color:dimgray;"></span> <span style="color:#3333FF;">jq</span><span style="color:dimgray;"></span> <span style="color:aqua;">.</span>
<span style="font-weight:bold;">[
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 1&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>10<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">,
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>4<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 2&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>5<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">,
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>12<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 3&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>2<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">
]</span>
<span style="color:dimgray;"></span><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/demo</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-X</span><span style="color:dimgray;"></span> <span style="color:aqua;">PUT</span><span style="color:dimgray;"></span> <span style="color:aqua;">-d</span><span style="color:dimgray;"></span> <span style="color:yellow;">'{&quot;id&quot;: 8, &quot;isPaused&quot;: true, &quot;isNamed&quot;: true, &quot;name&quot;: &quot;Test 3&quot;, &quot;duration&quot;: &quot;4w&quot;, &quot;account_id&quot;: 2}'</span><span style="color:dimgray;"></span> <span style="color:aqua;">--header</span><span style="color:dimgray;"></span> <span style="color:yellow;">&quot;Content-Type: application/json&quot;</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey</span>
{&quot;success&quot;: true}
<span style="color:dimgray;"></span><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/demo</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-s</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey</span><span style="color:dimgray;"></span> <span style="color:lime;">|</span><span style="color:dimgray;"></span> <span style="color:#3333FF;">jq</span><span style="color:dimgray;"></span> <span style="color:aqua;">.</span>
<span style="font-weight:bold;">[
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 1&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>10<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">,
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>4<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 2&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>5<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">,
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>12<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 3&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;4w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>2<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">
]</span>
<span style="color:dimgray;"></span><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/demo</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-X</span><span style="color:dimgray;"></span> <span style="color:aqua;">DELETE</span><span style="color:dimgray;"></span> <span style="color:aqua;">-d</span><span style="color:dimgray;"></span> <span style="color:yellow;">'{&quot;id&quot;: 12}'</span><span style="color:dimgray;"></span> <span style="color:aqua;">--header</span><span style="color:dimgray;"></span> <span style="color:yellow;">&quot;Content-Type: application/json&quot;</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey</span>
[{'id': 12, 'isPaused': 1, 'isNamed': 1, 'name': 'Test 3', 'duration': '4w', 'account_id': 2}]
<span style="color:dimgray;"></span><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/demo</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-s</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey</span><span style="color:dimgray;"></span> <span style="color:lime;">|</span><span style="color:dimgray;"></span> <span style="color:#3333FF;">jq</span><span style="color:dimgray;"></span> <span style="color:aqua;">.</span>
<span style="font-weight:bold;">[
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 1&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>10<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">,
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>4<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 2&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>5<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">
]</span>
</pre> <h3 id="api-survey-id"><a href="#api-survey-id" class="header-anchor">#</a> /api/survey/&lt;id&gt;</h3> <p>У цьому випадку доступні лише 3 методи (GET, PUT, DELETE), оскільки під час створення нового опитування його ідентифікатор визначається безпосередньо базою даних.</p> <pre style="color:#ffffff;font-size:10pt;"><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/restful-server</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-s</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey</span><span style="color:dimgray;"></span> <span style="color:lime;">|</span><span style="color:dimgray;"></span> <span style="color:#3333FF;">jq</span><span style="color:dimgray;"></span> <span style="color:aqua;">.</span>
<span style="font-weight:bold;">[
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 1&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>10<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">,
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>4<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>0<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 3&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;1w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>5<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">
]</span>
<span style="color:dimgray;"></span><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/restful-server</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-X</span><span style="color:dimgray;"></span> <span style="color:aqua;">PUT</span><span style="color:dimgray;"></span> \
<span style="color:aqua;">-d</span><span style="color:dimgray;"></span> <span style="color:yellow;">'{&quot;isPaused&quot;: true,
&quot;isNamed&quot;: true,
&quot;name&quot;: &quot;Test 4&quot;,
&quot;duration&quot;: &quot;2w&quot;}'</span><span style="color:dimgray;"></span> \
<span style="color:aqua;">--header</span><span style="color:dimgray;"></span> <span style="color:yellow;">&quot;Content-Type: application/json&quot;</span><span style="color:dimgray;"></span> \
<span style="color:aqua;">-s</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey/4 </span>
{&quot;success&quot;: true}
<span style="color:dimgray;"></span><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/restful-server</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-s</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey/4</span><span style="color:dimgray;"></span> <span style="color:lime;">|</span><span style="color:dimgray;"></span> <span style="color:#3333FF;">jq</span><span style="color:dimgray;"></span> <span style="color:aqua;">.</span><span style="color:dimgray;"></span>
<span style="font-weight:bold;">[
{
</span><span style="font-weight:bold;color:#3333FF;">&quot;id&quot;</span><span style="font-weight:bold;">: </span>4<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isPaused&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;isNamed&quot;</span><span style="font-weight:bold;">: </span>1<span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;name&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;Test 4&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;duration&quot;</span><span style="font-weight:bold;">: </span><span style="color:lime;">&quot;2w&quot;</span><span style="font-weight:bold;">,
</span><span style="font-weight:bold;color:#3333FF;">&quot;account_id&quot;</span><span style="font-weight:bold;">: </span>5<span style="font-weight:bold;">
}</span><span style="font-weight:bold;">
]</span>
<span style="color:dimgray;"></span><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/restful-server</span> (master)&gt; <span style="color:#3333FF;">curl</span><span style="color:dimgray;"></span> <span style="color:aqua;">-v</span><span style="color:dimgray;"></span> <span style="color:aqua;">-X</span><span style="color:dimgray;"></span> <span style="color:aqua;">DELETE</span><span style="color:dimgray;"></span> <span style="color:aqua;">--header</span><span style="color:dimgray;"></span> <span style="color:yellow;">&quot;Content-Type: application/json&quot;</span><span style="color:dimgray;"></span> <span style="color:aqua;">-d</span><span style="color:dimgray;"></span> <span style="color:yellow;">'{}'</span><span style="color:dimgray;"></span> <span style="color:aqua;">http://127.0.0.1:5000/api/survey/4 </span>
* Trying 127.0.0.1:5000...
* Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0)
&gt; DELETE /api/survey/4 HTTP/1.1
&gt; Host: 127.0.0.1:5000
&gt; User-Agent: curl/7.88.1
&gt; Accept: */*
&gt; Content-Type: application/json
&gt; Content-Length: 2
&gt;
&lt; HTTP/1.1 200 OK
&lt; Server: Werkzeug/3.0.3 Python/3.11.2
&lt; Date: Tue, 21 May 2024 14:45:09 GMT
&lt; Content-Type: text/html; charset=utf-8
&lt; Content-Length: 94
&lt; Connection: close
&lt;
[{'id': 4, 'isPaused': 1, 'isNamed': 1, 'name': 'Test 4', 'duration': '2w', 'account_id': 5}]
* Closing connection 0
<span style="color:dimgray;"></span><span style="filter:contrast(70%) brightness(190%);color:lime;">user</span>@debian-laptop <span style="color:lime;">~/D/f/t/f/d/m/e/s/restful-server</span> (master)&gt;
</pre> <p>Бачимо, що ми можемо отримувати інформацію про окремі опитування, змінювати та видаляти їх.</p></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Останнє оновлення:</span> <span class="time">5/21/2024, 8:40:46 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
<a href="/edu-dis-labs-private/software/" class="prev">
Реалізація інформаційного та програмного забезпечення
</a></span> <span class="next"><a href="/edu-dis-labs-private/conclusion/">
Висновки
</a>
</span></p></div> </main></div><div class="global-ui"><!----></div></div>
<script src="/edu-dis-labs-private/assets/js/app.183fc2e4.js" defer></script><script src="/edu-dis-labs-private/assets/js/2.11435098.js" defer></script><script src="/edu-dis-labs-private/assets/js/25.cc4d9332.js" defer></script>
</body>
</html>