모든 데모 다른 서비스 둘러보기
API 예제
DataDome
DataDome 보호의 연동 구조를 살펴보세요.
API 플레이그라운드
요청과 응답을 살펴보세요.
매개변수를 조정하고 갱신된 코드를 확인하세요. 이 미리보기는 API 요청을 보내거나 실제 챌린지를 해결하지 않습니다.
01매개변수 준비
02작업 생성
03결과 조회
예제 매개변수
datadome{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "datadome",
"websiteURL": "https://solucaptcha.com/"
}
}POST https://api.solucaptcha.com/createTask. YOUR_API_KEY는 서버에서만 교체하세요.
연동 예제
demo.mjsimport { setTimeout as sleep } from "node:timers/promises";
const API = "https://api.solucaptcha.com";
const clientKey = process.env.SOLUCAPTCHA_API_KEY;
if (!clientKey) throw new Error("Set SOLUCAPTCHA_API_KEY");
const task = {
"type": "datadome",
"websiteURL": "https://solucaptcha.com/"
};
async function post(path, body) {
const response = await fetch(API + path, {
method: "POST", redirect: "error",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ clientKey, ...body }),
signal: AbortSignal.timeout(15000),
});
if (!response.ok) throw new Error("HTTP " + response.status);
const data = await response.json();
if (data.errorId !== 0) throw new Error(data.errorDescription || "API_ERROR");
return data;
}
const { taskId } = await post("/createTask", { task });
if (!taskId) throw new Error("Missing taskId");
let completed = false;
for (let attempt = 0; attempt < 120; attempt++) {
await sleep(2500);
const result = await post("/getTaskResult", { taskId });
if (result.status === "completed") {
console.log(result.solution); completed = true; break;
}
if (result.status === "failed") throw new Error("Task failed");
if (!["pending", "processing"].includes(result.status)) throw new Error("Unexpected status");
}
if (!completed) throw new Error("Timeout: resume polling taskId=" + taskId);실제 작업을 실행하려면 계정 키를 사용하고 요금을 확인하세요. 성공한 경우에만 청구됩니다.
요금 보기