{"id":1086,"date":"2024-12-22T06:31:05","date_gmt":"2024-12-22T06:31:05","guid":{"rendered":"http:\/\/localhost\/?p=1086"},"modified":"2025-02-14T19:56:33","modified_gmt":"2025-02-14T12:56:33","slug":"check-writing-backend-api","status":"publish","type":"post","link":"https:\/\/studaca.online\/check-writing-backend-api\/","title":{"rendered":"Check Writing Backend API"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <title>API Analysis Test<\/title>\n  <style>\n    body {\n      font-family: Arial, sans-serif;\n      margin: 20px;\n      padding: 0;\n    }\n    form {\n      display: flex;\n      flex-direction: column;\n      gap: 10px;\n      max-width: 500px;\n    }\n    textarea {\n      width: 100%;\n      height: 80px;\n    }\n    button {\n      padding: 10px;\n      background-color: #007BFF;\n      color: white;\n      border: none;\n      cursor: pointer;\n    }\n    button:hover {\n      background-color: #0056b3;\n    }\n    .result {\n      margin-top: 20px;\n      padding: 10px;\n      border: 1px solid #ddd;\n      background-color: #f9f9f9;\n    }\n    pre {\n      white-space: pre-wrap;\n      word-wrap: break-word;\n    }\n  <\/style>\n<\/head>\n<body>\n\n<h1>Test API wordpress\/api\/v1\/analysis<\/h1>\n<form id=\"analysisForm\">\n  <label>\n    Question:\n    <textarea id=\"question\" required><\/textarea>\n  <\/label>\n  <label>\n    Answer:\n    <textarea id=\"answer\" required><\/textarea>\n  <\/label>\n  <label>\n    Sample:\n    <textarea id=\"sample\" required><\/textarea>\n  <\/label>\n  <label>\n    Part:\n    <input type=\"text\" id=\"part\" required \/>\n  <\/label>\n  <label>\n    ID Question:\n    <input type=\"text\" id=\"idquestion\" required \/>\n  <\/label>\n  <button type=\"submit\">Submit<\/button>\n<\/form>\n\n<div class=\"result\">\n  <h3>Result:<\/h3>\n  <pre id=\"result\"><\/pre>\n<\/div>\n\n<script>\n  document.getElementById('analysisForm').addEventListener('submit', async function (e) {\n    e.preventDefault(); \/\/ Prevent form submission\n\n    \/\/ Get form data\n    const question = document.getElementById('question').value;\n    const answer = document.getElementById('answer').value;\n    const sample = document.getElementById('sample').value;\n    const part = document.getElementById('part').value;\n    const idquestion = document.getElementById('idquestion').value;\n\n    try {\n      \/\/ Make API call\n      const response = await fetch('http:\/\/localhost\/api\/public\/test\/v1\/ielts\/writing\/', {\n        method: 'POST',\n        headers: {\n          'Content-Type': 'application\/json',\n        },\n        body: JSON.stringify({ question, answer, sample, part, idquestion }),\n      });\n\n      if (!response.ok) {\n        throw new Error(`HTTP error! status: ${response.status}`);\n      }\n\n      \/\/ Parse and display result\n      const result = await response.json();\n      document.getElementById('result').textContent = JSON.stringify(result, null, 2);\n    } catch (error) {\n      console.error('Error:', error);\n      document.getElementById('result').textContent = `Error: ${error.message}`;\n    }\n  });\n<\/script>\n\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>API Analysis Test Test API wordpress\/api\/v1\/analysis Question: Answer: Sample: Part: ID Question: Submit Result:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1086","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts\/1086","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/comments?post=1086"}],"version-history":[{"count":7,"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts\/1086\/revisions"}],"predecessor-version":[{"id":1401,"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts\/1086\/revisions\/1401"}],"wp:attachment":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/media?parent=1086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/categories?post=1086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/tags?post=1086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}