CIRCSTART
Déan do chéad iarratas API i gceann cúpla nóiméad.
Úsáid do chuntas, eochair API phríobháideach, logán aschuir tacaithe amháin, agus ceann amháin den dá mhodh teanga.
{
"text": "Ábhar foinse casta sa teanga roghnaithe.",
"locale": "ga",
"mode": "simple-language"
}Samplaí SDK agus cURL ar fáil
Réamhaisnéis
- Cuntas Simple8 saor in aisce nó íoctha le seoladh ríomhphoist fíoraithe
- Eochair API gníomhach cruthaithe san fheidhmchlár
- CURL nó ceann de na hamanna rith samplacha
- Comhábhar tástála poiblí, neamhchríche
Céim 1: Cláir a shuiteáil
export SIMPLE8_API_KEY="replace-with-your-sandbox-key"
export SIMPLE8_API_BASE_URL="https://api.simple8.de"Céim 2: Cuir an iarraidh ar aghaidh
Soláthraíonn an API Leagan 2 poiblí:
- POST /api/v2/translate
- POST /api/v2/translate/stream
- POST /api/v2/jobs
- GET /api/v2/jobs/{id}
- POST /api/v2/batches
- GET /api/v2/batches/{id}
Úsáid https://api.simple8.de i dtáirgeadh. Seol an eochair API mar chomhartha Iompróir ó do fhreastalaí.
curl --request POST \
--url "$SIMPLE8_API_BASE_URL/api/v2/translate" \
--header "Authorization: Bearer $SIMPLE8_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"text": "To complete the application, submit a valid identity document.",
"locale": "en",
"mode": "simple-language"
}'const response = await fetch(`${process.env.SIMPLE8_API_BASE_URL}/api/v2/translate`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SIMPLE8_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
text: "To complete the application, submit a valid identity document.",
locale: "en",
mode: "simple-language"
})
});
const result = await response.json();
if (!response.ok) {
throw new Error(`${result.error.code}: ${result.error.message}`);
}
console.log(result.output);<?php
$payload = json_encode([
"text" => "To complete the application, submit a valid identity document.",
"locale" => "en",
"mode" => "simple-language"
]);
$baseUrl = rtrim(getenv("SIMPLE8_API_BASE_URL"), "/");
$request = curl_init($baseUrl . "/api/v2/translate");
curl_setopt_array($request, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("SIMPLE8_API_KEY"),
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => $payload
]);
$response = curl_exec($request);
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
curl_close($request);
if ($status < 200 || $status >= 300) {
throw new RuntimeException($response);
}
$result = json_decode($response, true);
echo $result["output"];import os
import requests
base_url = os.environ["SIMPLE8_API_BASE_URL"].rstrip("/")
response = requests.post(
f"{base_url}/api/v2/translate",
headers={
"Authorization": f"Bearer {os.environ['SIMPLE8_API_KEY']}",
"Content-Type": "application/json",
},
json={
"text": "To complete the application, submit a valid identity document.",
"locale": "en",
"mode": "simple-language",
},
timeout=30,
)
response.raise_for_status()
print(response.json()["output"])Céim 3: Déan seiceáil ar an freagra
{
"requestId": "req_sync_001",
"locale": "en",
"mode": "simple-language",
"output": "Send a valid identity document with your application.",
"usage": {
"inputCharacters": 67,
"cacheHit": false
}
}Céim 4: Déan iarracht an dara modh
Is modhanna táirgí éagsúla iad Plain Language agus Easy Language. Roghnaigh an modh a oireann do na daoine is mian leat a bhaint amach.
{
"mode": "easy-language"
}Céimeanna eile
- Féach na cóidí áitiúla uile a thacaíonn le
- Déan comparáid idir polaitrí seachadta
- Léigh treoir um fhíorú
- Cruthaigh poist agus baisceanna le haghaidh sreafaí oibre níos mó
- Cumraigh críochphointe crúca gréasáin san fheidhmchlár
- Athbhreithnigh taisce, úsáid, agus iompar billeála