{"id":2012,"date":"2025-09-18T06:55:24","date_gmt":"2025-09-18T06:55:24","guid":{"rendered":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012"},"modified":"2025-09-18T10:01:00","modified_gmt":"2025-09-18T10:01:00","slug":"h6-api-kasutamine","status":"publish","type":"page","link":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012","title":{"rendered":"H6: API kasutamine"},"content":{"rendered":"\n<p><strong>API-p\u00e4ring<\/strong> on p\u00e4ring (request) teie programmist teisele teenusele v\u00f5i serverile interneti kaudu. P\u00e4ringus k\u00fcsite andmeid v\u00f5i saadate teavet.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>\u00dclesanne: Luuame veebileht  API-ga<\/strong><\/p>\n\n\n\n<p>Sisse logime sandbox-is ja luuame uus HTML static template fail ja kirjutame seda kood<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>&lt;!DOCTYPE html&gt;\n&lt;html lang=&quot;en&quot;&gt;\n  &lt;head&gt;\n    &lt;meta charset=&quot;UTF-8&quot; \/&gt;\n    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; \/&gt;\n    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;ie=edge&quot; \/&gt;\n    &lt;title&gt;Staric template&lt;\/title&gt;\n    &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot; \/&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h1&gt;API Request Bacon&lt;\/h1&gt;\n    &lt;button type=&quot;button&quot; onclick=&quot;loadDoc()&quot;&gt;Request bacon&lt;\/button&gt;\n    &lt;p id=&quot;demo&quot;&gt;&lt;\/p&gt;\n    &lt;script&gt;\n      function loadDoc() {\n        const xhttp = new XMLHttpRequest();\n        xhttp.onload = function () {\n          document.getElementById(&quot;demo&quot;).innerHTML = this.responseText;\n        };\n        xhttp.open(\n          &quot;GET&quot;,\n          &quot;API link&quot;\n        );\n        xhttp.send();\n      }\n    &lt;\/script&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"701\" height=\"878\" src=\"https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4.png\" alt=\"\" class=\"wp-image-2013\" srcset=\"https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4.png 701w, https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4-240x300.png 240w, https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4-120x150.png 120w, https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4-600x751.png 600w\" sizes=\"(max-width: 701px) 100vw, 701px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center\"><strong>Oma API <\/strong><\/p>\n\n\n\n<p>Leidsin liha-teemaline juhusliku teksti generaator<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>https:\/\/baconipsum.com\/api\/?type=meat&paras=3&format=text<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"894\" height=\"883\" src=\"https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/7977E6A4-2DE1-4E62-B7B9-836F961A66DC.png\" alt=\"\" class=\"wp-image-2014\" srcset=\"https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/7977E6A4-2DE1-4E62-B7B9-836F961A66DC.png 894w, https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/7977E6A4-2DE1-4E62-B7B9-836F961A66DC-300x296.png 300w, https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/7977E6A4-2DE1-4E62-B7B9-836F961A66DC-768x759.png 768w, https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/7977E6A4-2DE1-4E62-B7B9-836F961A66DC-150x148.png 150w, https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/7977E6A4-2DE1-4E62-B7B9-836F961A66DC-600x593.png 600w, https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/7977E6A4-2DE1-4E62-B7B9-836F961A66DC-100x100.png 100w\" sizes=\"(max-width: 894px) 100vw, 894px\" \/><\/figure>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-css\" data-lang=\"CSS\"><code>body {\n  font-family: &quot;Segoe UI&quot;, Tahoma, Geneva, Verdana, sans-serif;\n  background: #fff8f0;\n  color: #4a4a4a;\n  margin: 0;\n  padding: 40px;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  min-height: 100vh;\n}\n\nh1 {\n  color: #d94f04;\n  margin-bottom: 20px;\n  font-weight: 700;\n}\n\nbutton {\n  background-color: #d94f04;\n  color: white;\n  border: none;\n  padding: 15px 30px;\n  border-radius: 30px;\n  font-size: 1.1rem;\n  cursor: pointer;\n  margin-bottom: 30px;\n}\n#demo {\n  max-width: 700px;\n  background: #fff3e6;\n  border-radius: 15px;\n  padding: 25px 30px;\n  line-height: 1.6;\n  color: #5a3d00;\n  text-align: justify;\n}\n<\/code><\/pre><\/div>\n\n\n\n<p class=\"has-text-align-center\"><strong>Kokkuv\u00f5tte\/P\u00e4ringud<\/strong><\/p>\n\n\n\n<p>avame uus HTTP p\u00e4ring<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>xhttp.open(&quot;GET&quot;, url)<\/code><\/pre><\/div>\n\n\n\n<p>saab p\u00e4ringu serverisse <\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>xhttp.send();<\/code><\/pre><\/div>\n\n\n\n<p>AJAX p\u00e4ring mis saab API aadressile p\u00e4ring<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>XMLHttpRequest <\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>API-p\u00e4ring on p\u00e4ring (request) teie programmist teisele teenusele v\u00f5i serverile interneti kaudu. P\u00e4ringus k\u00fcsite andmeid v\u00f5i saadate teavet. \u00dclesanne: Luuame veebileht API-ga Sisse logime sandbox-is ja luuame uus HTML static template fail ja kirjutame seda kood Oma API Leidsin liha-teemaline juhusliku teksti generaator Kokkuv\u00f5tte\/P\u00e4ringud avame uus HTTP p\u00e4ring saab p\u00e4ringu serverisse AJAX p\u00e4ring mis saab [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2012","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>H6: API kasutamine - Marija Gorbunova portfoolio TARpv23<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012\" \/>\n<meta property=\"og:locale\" content=\"et_EE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"H6: API kasutamine - Marija Gorbunova portfoolio TARpv23\" \/>\n<meta property=\"og:description\" content=\"API-p\u00e4ring on p\u00e4ring (request) teie programmist teisele teenusele v\u00f5i serverile interneti kaudu. P\u00e4ringus k\u00fcsite andmeid v\u00f5i saadate teavet. \u00dclesanne: Luuame veebileht API-ga Sisse logime sandbox-is ja luuame uus HTML static template fail ja kirjutame seda kood Oma API Leidsin liha-teemaline juhusliku teksti generaator Kokkuv\u00f5tte\/P\u00e4ringud avame uus HTTP p\u00e4ring saab p\u00e4ringu serverisse AJAX p\u00e4ring mis saab [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012\" \/>\n<meta property=\"og:site_name\" content=\"Marija Gorbunova portfoolio TARpv23\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-18T10:01:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4.png\" \/>\n\t<meta property=\"og:image:width\" content=\"701\" \/>\n\t<meta property=\"og:image:height\" content=\"878\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minut\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/?page_id=2012\",\"url\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/?page_id=2012\",\"name\":\"H6: API kasutamine - Marija Gorbunova portfoolio TARpv23\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/?page_id=2012#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/?page_id=2012#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4.png\",\"datePublished\":\"2025-09-18T06:55:24+00:00\",\"dateModified\":\"2025-09-18T10:01:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/?page_id=2012#breadcrumb\"},\"inLanguage\":\"et\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/?page_id=2012\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"et\",\"@id\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/?page_id=2012#primaryimage\",\"url\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4.png\",\"contentUrl\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4.png\",\"width\":701,\"height\":878},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/?page_id=2012#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"H6: API kasutamine\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/#website\",\"url\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/\",\"name\":\"Marija Gorbunova portfoolio TARpv23\",\"description\":\"J&auml;rgmine WordPress veebileht\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/marijagorbunova23.thkit.ee\\\/wp\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"et\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"H6: API kasutamine - Marija Gorbunova portfoolio TARpv23","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012","og_locale":"et_EE","og_type":"article","og_title":"H6: API kasutamine - Marija Gorbunova portfoolio TARpv23","og_description":"API-p\u00e4ring on p\u00e4ring (request) teie programmist teisele teenusele v\u00f5i serverile interneti kaudu. P\u00e4ringus k\u00fcsite andmeid v\u00f5i saadate teavet. \u00dclesanne: Luuame veebileht API-ga Sisse logime sandbox-is ja luuame uus HTML static template fail ja kirjutame seda kood Oma API Leidsin liha-teemaline juhusliku teksti generaator Kokkuv\u00f5tte\/P\u00e4ringud avame uus HTTP p\u00e4ring saab p\u00e4ringu serverisse AJAX p\u00e4ring mis saab [&hellip;]","og_url":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012","og_site_name":"Marija Gorbunova portfoolio TARpv23","article_modified_time":"2025-09-18T10:01:00+00:00","og_image":[{"width":701,"height":878,"url":"https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minut"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012","url":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012","name":"H6: API kasutamine - Marija Gorbunova portfoolio TARpv23","isPartOf":{"@id":"https:\/\/marijagorbunova23.thkit.ee\/wp\/#website"},"primaryImageOfPage":{"@id":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012#primaryimage"},"image":{"@id":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012#primaryimage"},"thumbnailUrl":"https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4.png","datePublished":"2025-09-18T06:55:24+00:00","dateModified":"2025-09-18T10:01:00+00:00","breadcrumb":{"@id":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012#breadcrumb"},"inLanguage":"et","potentialAction":[{"@type":"ReadAction","target":["https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012"]}]},{"@type":"ImageObject","inLanguage":"et","@id":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012#primaryimage","url":"https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4.png","contentUrl":"https:\/\/marijagorbunova23.thkit.ee\/wp\/wp-content\/uploads\/2025\/09\/AA5B95F3-BA40-4A8B-BA67-F531D280E2B4.png","width":701,"height":878},{"@type":"BreadcrumbList","@id":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?page_id=2012#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/marijagorbunova23.thkit.ee\/wp\/"},{"@type":"ListItem","position":2,"name":"H6: API kasutamine"}]},{"@type":"WebSite","@id":"https:\/\/marijagorbunova23.thkit.ee\/wp\/#website","url":"https:\/\/marijagorbunova23.thkit.ee\/wp\/","name":"Marija Gorbunova portfoolio TARpv23","description":"J&auml;rgmine WordPress veebileht","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/marijagorbunova23.thkit.ee\/wp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"et"}]}},"_links":{"self":[{"href":"https:\/\/marijagorbunova23.thkit.ee\/wp\/index.php?rest_route=\/wp\/v2\/pages\/2012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/marijagorbunova23.thkit.ee\/wp\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/marijagorbunova23.thkit.ee\/wp\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/marijagorbunova23.thkit.ee\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/marijagorbunova23.thkit.ee\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2012"}],"version-history":[{"count":3,"href":"https:\/\/marijagorbunova23.thkit.ee\/wp\/index.php?rest_route=\/wp\/v2\/pages\/2012\/revisions"}],"predecessor-version":[{"id":2018,"href":"https:\/\/marijagorbunova23.thkit.ee\/wp\/index.php?rest_route=\/wp\/v2\/pages\/2012\/revisions\/2018"}],"wp:attachment":[{"href":"https:\/\/marijagorbunova23.thkit.ee\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}