인증
EVA_API_TOKEN을 환경 변수에 둡니다. Authorization: Bearer. 문서에 실제 토큰은 없습니다.
API / OPENAPI
EVA_API_TOKEN을 환경 변수에 둡니다. Authorization: Bearer. 문서에 실제 토큰은 없습니다.
GET https://eva.dashen.wang/api/v1/stats · GET https://eva.dashen.wang/api/v1/meta · POST https://eva.dashen.wang/api/v1/covers · POST https://eva.dashen.wang/api/v1/exports
OpenAPI: https://eva.dashen.wang/api/v1/openapi.json
curl -sS https://eva.dashen.wang/api/v1/stats
curl -sS -H "Authorization: Bearer $EVA_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: demo-001" \
-d '{"formatId":"article","themeId":"mono","output":"webp","quality":80,"content":{"title":"标题"}}' \
https://eva.dashen.wang/api/v1/covers -o cover.webpconst res = await fetch('https://eva.dashen.wang/api/v1/covers', {
method: 'POST',
headers: {
Authorization: 'Bearer ' + process.env.EVA_API_TOKEN,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
formatId: 'article',
themeId: 'mono',
output: 'webp',
quality: 80,
content: { title: '标题', subtitle: '副标题' },
}),
});
const blob = await res.blob();$ch = curl_init('https://eva.dashen.wang/api/v1/covers');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('EVA_API_TOKEN'),
'Content-Type: application/json',
'Idempotency-Key: wp-' . wp_generate_uuid4(),
],
CURLOPT_POSTFIELDS => wp_json_encode([
'formatId' => 'article',
'themeId' => 'mono',
'output' => 'webp',
'quality' => 80,
'content' => ['title' => get_the_title($post)],
]),
CURLOPT_RETURNTRANSFER => true,
]);
$image = curl_exec($ch);