--- title: "同期的に GET / POST リクエストを送る" slug: "xhr-get-post" updated: 2025-08-26T07:13:29Z published: 2025-08-26T07:13:29Z canonical: "helpcenter.autify.com/xhr-get-post" --- > ## Documentation Index > Fetch the complete documentation index at: https://helpcenter.autify.com/llms.txt > Use this file to discover all available pages before exploring further. # 同期的に GET / POST リクエストを送る 指定した API エンドポイント に対して GET / POST リクエストを送ります。 これらのコードはサンプルですので、ヘッダーやボディにはリクエストする API の仕様に沿って適切な値を設定してください。 ## **指定した URL に対して GET リクエストを送る** ```typescript const url = "API URL"; // Send GET request const response = await page.request.get(url); // Check status code if (response.status() !== 200) {  throw new Error("Error " + response.status()); } // Parse JSON and output log const data = await response.json(); console.log(data); ``` ## **指定した URL に対して POST リクエストを送る** ```typescript const url = "API URL"; // Send POST request const response = await page.request.post(url, {  headers: {    "Content-Type": "application/x-www-form-urlencoded",  },  data: "key=value",  // Form data }); // Check status code if (response.status() !== 200) {  throw new Error("Error " + response.status()); } // Parse JSON and output log const data = await response.json(); console.log(data); ```