मुखपृष्ठ / उत्पाद विवरण का परीक्षण

उत्पाद विवरण का परीक्षण

TEST कुंजी और टेस्ट पते से उत्पाद विवरण बनाना जाँचें। जवाब सिमुलेट किए जाते हैं और प्रोडक्शन खाते से वास्तविक शुल्क नहीं कटता।

इस पेज पर

यह निर्देश टेस्ट वातावरण के लिए है। सभी चरणों में TEST कुंजी और /public-api-test/v1 का उपयोग करें। उदाहरण परिणामों का अनुकरण करते हैं; वास्तविक जनरेशन या प्रोडक्शन खाते में शुल्क नहीं होता।

उत्पाद के नाम और विशेषताओं से कैटलॉग विवरण बनाएँ। API HTML सामग्री, पेज शीर्षक, मेटा विवरण और H1 लौटाता है। निर्माण पृष्ठभूमि में होता है: लागत का अनुमान लें, दस्तावेज़ बनाएँ और उसके पहचानकर्ता से परिणाम प्राप्त करें।

दोनों POST अनुरोधों के JSON बॉडी में तीनों फ़ील्ड आवश्यक हैं। Content-Type: application/json भेजें। सीमा 16 KiB है। निर्माण के लिए ai-product-descriptions:write तथा अनुमान और परिणाम पढ़ने के लिए ai-product-descriptions:read आवश्यक है।

पैरामीटर विवरण
title · string उत्पाद का नाम और मुख्य विशेषताएँ: 1–256 अक्षर। पहचान के लिए मॉडल, सामग्री, आकार या उपयोग बताएँ।
language · string नीचे दी गई तालिका का भाषा कोड। यह फ़ील्ड परिणाम की भाषा तय करता है।
word_count · integer पैरामीटर मान और लक्षित लंबाई: 400 → 400–600 शब्द; 600 → 600–800 शब्द; 800 → 800–1200 शब्द। वास्तविक शब्द संख्या actual_words में मिलती है।

समर्थित भाषाएँ

हिंदी में विवरण बनाने के लिए hi दें। स्वीकार्य भाषा कोड ProductDescriptionRequest में दिए गए हैं।

POST /public-api-test/v1/ai-writer/product-descriptions/cost

निर्माण शुरू किए या क्रेडिट खर्च किए बिना लागत का अनुमान देता है। cost, total_credits, remaining_credits और has_enough_credits लौटाता है। बनाने से पहले has_enough_credits जाँचें; अनुमान बैलेंस आरक्षित नहीं करता।

curl

curl --fail-with-body --silent --show-error --location \
  --request POST \
  --header 'Authorization: Bearer YOUR_TEST_API_KEY' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "Ceramic coffee mug, 350 ml, dishwasher safe",
  "language": "en",
  "word_count": 400
}' \
  'https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/cost'

JavaScript

async function main () {
  const response = await fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/cost", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_TEST_API_KEY",
      "Accept": "application/json",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      "title": "Ceramic coffee mug, 350 ml, dishwasher safe",
      "language": "en",
      "word_count": 400
    }),
    signal: AbortSignal.timeout(30_000),
  })

  if (!response.ok) {
    const responseText = await response.text()
    throw new Error(`HTTP ${response.status}: ${responseText}`)
  }

  const responseText = await response.text()
  const data = responseText && response.headers.get("content-type")?.includes("application/json") ? JSON.parse(responseText) : responseText

  console.log(data)
}

main().catch(error => {
  console.error(error)
  process.exitCode = 1
})

Python

import json
import requests

url = "https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/cost"
headers = {
    "Authorization": "Bearer YOUR_TEST_API_KEY",
    "Accept": "application/json",
    "Content-Type": "application/json",
}
payload = json.loads("{\n  \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n  \"language\": \"en\",\n  \"word_count\": 400\n}")

response = requests.request(
    "POST",
    url,
    headers=headers,
    json=payload,
    timeout=30,
)
response.raise_for_status()
print(json.dumps(response.json(), ensure_ascii=False, indent=2) if response.content and "application/json" in response.headers.get("Content-Type", "") else response.text)

PHP

<?php

$curl = curl_init('https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/cost');

if ($curl === false) {
    throw new RuntimeException('Unable to initialize cURL');
}

curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_TEST_API_KEY',
        'Accept: application/json',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => '{
  "title": "Ceramic coffee mug, 350 ml, dishwasher safe",
  "language": "en",
  "word_count": 400
}',
]);

$response = curl_exec($curl);

if ($response === false) {
    $message = curl_error($curl);
    curl_close($curl);
    throw new RuntimeException('Network error: ' . $message);
}

$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE) ?: '';
curl_close($curl);

if ($status < 200 || $status >= 300) {
    throw new RuntimeException("HTTP $status: $response");
}

if ($response !== '' && str_contains($contentType, 'application/json')) {
    print_r(json_decode($response, true, 512, JSON_THROW_ON_ERROR));
} else {
    echo $response;
}

Go

package main

import (
	"context"
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
	"time"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancel()

	request, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/cost", strings.NewReader("{\n  \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n  \"language\": \"en\",\n  \"word_count\": 400\n}"))
	if err != nil {
		panic(err)
	}

	request.Header.Set("Authorization", "Bearer YOUR_TEST_API_KEY")
	request.Header.Set("Accept", "application/json")
	request.Header.Set("Content-Type", "application/json")

	client := &http.Client{Timeout: 30 * time.Second}
	response, err := client.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	if response.StatusCode < http.StatusOK || response.StatusCode >= http.StatusMultipleChoices {
		errorBody, readErr := io.ReadAll(response.Body)
		if readErr != nil {
			panic(readErr)
		}
		panic(fmt.Sprintf("HTTP %d: %s", response.StatusCode, errorBody))
	}

	if _, err := io.Copy(os.Stdout, response.Body); err != nil {
		panic(err)
	}
}

Google Apps Script

function callLabrikaPublicAPI() {
  const response = UrlFetchApp.fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/cost", {
    method: "post",
    headers: {
      "Authorization": "Bearer YOUR_TEST_API_KEY",
      "Accept": "application/json",
      "Content-Type": "application/json",
    },
    payload: "{\n  \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n  \"language\": \"en\",\n  \"word_count\": 400\n}",
    followRedirects: false,
    muteHttpExceptions: true,
  });
  const status = response.getResponseCode();
  if (status < 200 || status >= 300) {
    throw new Error('HTTP ' + status + ': ' + response.getContentText());
  }
  Logger.log(response.getContentText());
}

POST /public-api-test/v1/ai-writer/product-descriptions/documents

निर्माण शुरू करता है। हर नए दस्तावेज़ के लिए अद्वितीय Idempotency-Key भेजें। HTTP 202 में document_id, status, cost और has_enough_credits मिलते हैं। परिणाम लेने के लिए document_id सहेजें।

curl

curl --fail-with-body --silent --show-error --location \
  --request POST \
  --header 'Authorization: Bearer YOUR_TEST_API_KEY' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: product-123-description-v1' \
  --data '{
  "title": "Ceramic coffee mug, 350 ml, dishwasher safe",
  "language": "en",
  "word_count": 400
}' \
  'https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents'

JavaScript

async function main () {
  const response = await fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_TEST_API_KEY",
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Idempotency-Key": "product-123-description-v1",
    },
    body: JSON.stringify({
      "title": "Ceramic coffee mug, 350 ml, dishwasher safe",
      "language": "en",
      "word_count": 400
    }),
    signal: AbortSignal.timeout(30_000),
  })

  if (!response.ok) {
    const responseText = await response.text()
    throw new Error(`HTTP ${response.status}: ${responseText}`)
  }

  const responseText = await response.text()
  const data = responseText && response.headers.get("content-type")?.includes("application/json") ? JSON.parse(responseText) : responseText

  console.log(data)
}

main().catch(error => {
  console.error(error)
  process.exitCode = 1
})

Python

import json
import requests

url = "https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents"
headers = {
    "Authorization": "Bearer YOUR_TEST_API_KEY",
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Idempotency-Key": "product-123-description-v1",
}
payload = json.loads("{\n  \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n  \"language\": \"en\",\n  \"word_count\": 400\n}")

response = requests.request(
    "POST",
    url,
    headers=headers,
    json=payload,
    timeout=30,
)
response.raise_for_status()
print(json.dumps(response.json(), ensure_ascii=False, indent=2) if response.content and "application/json" in response.headers.get("Content-Type", "") else response.text)

PHP

<?php

$curl = curl_init('https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents');

if ($curl === false) {
    throw new RuntimeException('Unable to initialize cURL');
}

curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_TEST_API_KEY',
        'Accept: application/json',
        'Content-Type: application/json',
        'Idempotency-Key: product-123-description-v1',
    ],
    CURLOPT_POSTFIELDS => '{
  "title": "Ceramic coffee mug, 350 ml, dishwasher safe",
  "language": "en",
  "word_count": 400
}',
]);

$response = curl_exec($curl);

if ($response === false) {
    $message = curl_error($curl);
    curl_close($curl);
    throw new RuntimeException('Network error: ' . $message);
}

$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE) ?: '';
curl_close($curl);

if ($status < 200 || $status >= 300) {
    throw new RuntimeException("HTTP $status: $response");
}

if ($response !== '' && str_contains($contentType, 'application/json')) {
    print_r(json_decode($response, true, 512, JSON_THROW_ON_ERROR));
} else {
    echo $response;
}

Go

package main

import (
	"context"
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
	"time"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancel()

	request, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents", strings.NewReader("{\n  \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n  \"language\": \"en\",\n  \"word_count\": 400\n}"))
	if err != nil {
		panic(err)
	}

	request.Header.Set("Authorization", "Bearer YOUR_TEST_API_KEY")
	request.Header.Set("Accept", "application/json")
	request.Header.Set("Content-Type", "application/json")
	request.Header.Set("Idempotency-Key", "product-123-description-v1")

	client := &http.Client{Timeout: 30 * time.Second}
	response, err := client.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	if response.StatusCode < http.StatusOK || response.StatusCode >= http.StatusMultipleChoices {
		errorBody, readErr := io.ReadAll(response.Body)
		if readErr != nil {
			panic(readErr)
		}
		panic(fmt.Sprintf("HTTP %d: %s", response.StatusCode, errorBody))
	}

	if _, err := io.Copy(os.Stdout, response.Body); err != nil {
		panic(err)
	}
}

Google Apps Script

function callLabrikaPublicAPI() {
  const response = UrlFetchApp.fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents", {
    method: "post",
    headers: {
      "Authorization": "Bearer YOUR_TEST_API_KEY",
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Idempotency-Key": "product-123-description-v1",
    },
    payload: "{\n  \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n  \"language\": \"en\",\n  \"word_count\": 400\n}",
    followRedirects: false,
    muteHttpExceptions: true,
  });
  const status = response.getResponseCode();
  if (status < 200 || status >= 300) {
    throw new Error('HTTP ' + status + ': ' + response.getContentText());
  }
  Logger.log(response.getContentText());
}

GET /public-api-test/v1/ai-writer/product-descriptions/documents/{document_id}

pending होने पर retry_after_seconds के बाद GET दोहराएँ (आमतौर पर 10 सेकंड)। success में content (HTML), title, description, h1, actual_words और credits_spent मिलते हैं। error में error_code पढ़ें; credits_spent 0 होता है।

curl

curl --fail-with-body --silent --show-error --location \
  --header 'Authorization: Bearer YOUR_TEST_API_KEY' \
  --header 'Accept: application/json' \
  'https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID'

JavaScript

async function main () {
  const response = await fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID", {
    method: "GET",
    headers: {
      "Authorization": "Bearer YOUR_TEST_API_KEY",
      "Accept": "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  })

  if (!response.ok) {
    const responseText = await response.text()
    throw new Error(`HTTP ${response.status}: ${responseText}`)
  }

  const responseText = await response.text()
  const data = responseText && response.headers.get("content-type")?.includes("application/json") ? JSON.parse(responseText) : responseText

  console.log(data)
}

main().catch(error => {
  console.error(error)
  process.exitCode = 1
})

Python

import json
import requests

url = "https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID"
headers = {
    "Authorization": "Bearer YOUR_TEST_API_KEY",
    "Accept": "application/json",
}

response = requests.request(
    "GET",
    url,
    headers=headers,
    timeout=30,
)
response.raise_for_status()
print(json.dumps(response.json(), ensure_ascii=False, indent=2) if response.content and "application/json" in response.headers.get("Content-Type", "") else response.text)

PHP

<?php

$curl = curl_init('https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID');

if ($curl === false) {
    throw new RuntimeException('Unable to initialize cURL');
}

curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_TEST_API_KEY',
        'Accept: application/json',
    ],
]);

$response = curl_exec($curl);

if ($response === false) {
    $message = curl_error($curl);
    curl_close($curl);
    throw new RuntimeException('Network error: ' . $message);
}

$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE) ?: '';
curl_close($curl);

if ($status < 200 || $status >= 300) {
    throw new RuntimeException("HTTP $status: $response");
}

if ($response !== '' && str_contains($contentType, 'application/json')) {
    print_r(json_decode($response, true, 512, JSON_THROW_ON_ERROR));
} else {
    echo $response;
}

Go

package main

import (
	"context"
	"fmt"
	"io"
	"net/http"
	"os"
	"time"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancel()

	request, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID", nil)
	if err != nil {
		panic(err)
	}

	request.Header.Set("Authorization", "Bearer YOUR_TEST_API_KEY")
	request.Header.Set("Accept", "application/json")

	client := &http.Client{Timeout: 30 * time.Second}
	response, err := client.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	if response.StatusCode < http.StatusOK || response.StatusCode >= http.StatusMultipleChoices {
		errorBody, readErr := io.ReadAll(response.Body)
		if readErr != nil {
			panic(readErr)
		}
		panic(fmt.Sprintf("HTTP %d: %s", response.StatusCode, errorBody))
	}

	if _, err := io.Copy(os.Stdout, response.Body); err != nil {
		panic(err)
	}
}

Google Apps Script

function callLabrikaPublicAPI() {
  const response = UrlFetchApp.fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID", {
    method: "get",
    headers: {
      "Authorization": "Bearer YOUR_TEST_API_KEY",
      "Accept": "application/json",
    },
    followRedirects: false,
    muteHttpExceptions: true,
  });
  const status = response.getResponseCode();
  if (status < 200 || status >= 300) {
    throw new Error('HTTP ' + status + ': ' + response.getContentText());
  }
  Logger.log(response.getContentText());
}

POST उत्तर खो जाने पर उसी API कुंजी, Idempotency-Key और बॉडी के साथ दोहराएँ। सहेजा उत्तर 24 घंटे तक लौटता है। अलग बॉडी या अधूरा अनुरोध HTTP 409 देता है। अपर्याप्त क्रेडिट होने पर बैलेंस बढ़ाएँ और नई कुंजी उपयोग करें।

product_not_recognized: नाम और विशेषताएँ स्पष्ट करें। product_description_failed: निर्माण विफल रहा। ज्ञात पहचान विफलता तुरंत HTTP 422 दे सकती है और उसी उत्पाद के लिए 7 दिन कैश में रहती है। नई कुंजी इस कैश को नहीं टालती।

शुरुआत में AI क्रेडिट आरक्षित होते हैं। सफलता पर credits_spent वास्तविक खपत बताता है और बचा आरक्षण वापस मिलता है। निर्माण विफल होने पर क्रेडिट खर्च नहीं होते।

परीक्षण मोड में त्रुटियाँ दोहराने के लिए ये title मान उपयोग करें। प्रत्येक परिदृश्य के लिए नया Idempotency-Key रखें।

title परिणाम
sandbox:product_not_recognized तुरंत HTTP 422
sandbox:async_product_not_recognized pending, फिर error product_not_recognized
sandbox:product_description_failed pending, फिर error product_description_failed

curl

curl --fail-with-body --silent --show-error --location \
  --request POST \
  --header 'Authorization: Bearer YOUR_TEST_API_KEY' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: sandbox-product-not-recognized-v1' \
  --data '{
  "title": "sandbox:product_not_recognized",
  "language": "en",
  "word_count": 400
}' \
  'https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents'

JavaScript

async function main () {
  const response = await fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_TEST_API_KEY",
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Idempotency-Key": "sandbox-product-not-recognized-v1",
    },
    body: JSON.stringify({
      "title": "sandbox:product_not_recognized",
      "language": "en",
      "word_count": 400
    }),
    signal: AbortSignal.timeout(30_000),
  })

  if (!response.ok) {
    const responseText = await response.text()
    throw new Error(`HTTP ${response.status}: ${responseText}`)
  }

  const responseText = await response.text()
  const data = responseText && response.headers.get("content-type")?.includes("application/json") ? JSON.parse(responseText) : responseText

  console.log(data)
}

main().catch(error => {
  console.error(error)
  process.exitCode = 1
})

Python

import json
import requests

url = "https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents"
headers = {
    "Authorization": "Bearer YOUR_TEST_API_KEY",
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Idempotency-Key": "sandbox-product-not-recognized-v1",
}
payload = json.loads("{\n  \"title\": \"sandbox:product_not_recognized\",\n  \"language\": \"en\",\n  \"word_count\": 400\n}")

response = requests.request(
    "POST",
    url,
    headers=headers,
    json=payload,
    timeout=30,
)
response.raise_for_status()
print(json.dumps(response.json(), ensure_ascii=False, indent=2) if response.content and "application/json" in response.headers.get("Content-Type", "") else response.text)

PHP

<?php

$curl = curl_init('https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents');

if ($curl === false) {
    throw new RuntimeException('Unable to initialize cURL');
}

curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_TEST_API_KEY',
        'Accept: application/json',
        'Content-Type: application/json',
        'Idempotency-Key: sandbox-product-not-recognized-v1',
    ],
    CURLOPT_POSTFIELDS => '{
  "title": "sandbox:product_not_recognized",
  "language": "en",
  "word_count": 400
}',
]);

$response = curl_exec($curl);

if ($response === false) {
    $message = curl_error($curl);
    curl_close($curl);
    throw new RuntimeException('Network error: ' . $message);
}

$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE) ?: '';
curl_close($curl);

if ($status < 200 || $status >= 300) {
    throw new RuntimeException("HTTP $status: $response");
}

if ($response !== '' && str_contains($contentType, 'application/json')) {
    print_r(json_decode($response, true, 512, JSON_THROW_ON_ERROR));
} else {
    echo $response;
}

Go

package main

import (
	"context"
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
	"time"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
	defer cancel()

	request, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents", strings.NewReader("{\n  \"title\": \"sandbox:product_not_recognized\",\n  \"language\": \"en\",\n  \"word_count\": 400\n}"))
	if err != nil {
		panic(err)
	}

	request.Header.Set("Authorization", "Bearer YOUR_TEST_API_KEY")
	request.Header.Set("Accept", "application/json")
	request.Header.Set("Content-Type", "application/json")
	request.Header.Set("Idempotency-Key", "sandbox-product-not-recognized-v1")

	client := &http.Client{Timeout: 30 * time.Second}
	response, err := client.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	if response.StatusCode < http.StatusOK || response.StatusCode >= http.StatusMultipleChoices {
		errorBody, readErr := io.ReadAll(response.Body)
		if readErr != nil {
			panic(readErr)
		}
		panic(fmt.Sprintf("HTTP %d: %s", response.StatusCode, errorBody))
	}

	if _, err := io.Copy(os.Stdout, response.Body); err != nil {
		panic(err)
	}
}

Google Apps Script

function callLabrikaPublicAPI() {
  const response = UrlFetchApp.fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents", {
    method: "post",
    headers: {
      "Authorization": "Bearer YOUR_TEST_API_KEY",
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Idempotency-Key": "sandbox-product-not-recognized-v1",
    },
    payload: "{\n  \"title\": \"sandbox:product_not_recognized\",\n  \"language\": \"en\",\n  \"word_count\": 400\n}",
    followRedirects: false,
    muteHttpExceptions: true,
  });
  const status = response.getResponseCode();
  if (status < 200 || status >= 300) {
    throw new Error('HTTP ' + status + ': ' + response.getContentText());
  }
  Logger.log(response.getContentText());
}

AI परिणाम इस्तेमाल करने से पहले तथ्य, कंपनी या उत्पाद का नाम, भाषा और इनपुट से मेल जाँचें। उत्पन्न HTML प्रकाशन से पहले पढ़ें। तकनीकी सफलता सामग्री की समीक्षा का विकल्प नहीं है।