技能 编程开发 诊断和修复Grammarly错误

诊断和修复Grammarly错误

v20260423
grammarly-common-errors
本工具旨在提供关于Grammarly API集成时常见技术错误和异常的诊断及修复指南。它涵盖了HTTP状态码错误(如400、401、429)的处理方法,帮助用户解决API连接失败、令牌过期、内容超出限制或达到请求频率上限等技术问题,适用于API调试和故障排除。
获取技能
214 次下载
概览

Grammarly Common Errors

Error Reference

400 Bad Request — Text Too Short

Cause: Text has fewer than 30 words. Fix: Ensure minimum 30 words. Pad short texts with context if needed.

401 Unauthorized

Cause: Token expired or invalid. Fix: Re-authenticate with client credentials grant.

413 Payload Too Large

Cause: Text exceeds 100,000 characters or 4 MB. Fix: Split into chunks using paragraph boundaries. See grammarly-sdk-patterns for chunking function.

429 Too Many Requests

Cause: Rate limit exceeded. Fix: Implement exponential backoff. See grammarly-rate-limits.

Plagiarism Check Stuck on "pending"

Cause: Large document processing or service delay. Fix: Poll every 3-5 seconds, timeout after 90 seconds.

AI Detection — Inconsistent Scores

Cause: Short text produces unreliable results. Fix: AI detection works best on 200+ words. Scores on short text are less reliable.

Quick Diagnostics

# Test API connectivity
curl -s -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer $GRAMMARLY_ACCESS_TOKEN" \
  https://api.grammarly.com/ecosystem/api/v2/scores

# Test with sample text
curl -X POST https://api.grammarly.com/ecosystem/api/v2/scores \
  -H "Authorization: Bearer $GRAMMARLY_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text": "This is a test sentence that has more than thirty words so that the API will accept it and return a valid writing score for our diagnostic purposes."}' | python3 -m json.tool

Resources

Next Steps

For debugging tools, see grammarly-debug-bundle.

信息
Category 编程开发
Name grammarly-common-errors
版本 v20260423
大小 2.17KB
更新时间 2026-04-28
语言