API Guide
🚀Welcome to Shodo API documentation🚀
Command
You can use Shodo's API from shodo command. For example, you can proofread Japanese in a Markdown file.
$ pip install shodo
$ shodo login
$ shodo lint README.md
For more details, refer shodo command's README.
API root
Specify Organization slug and project name.
https://api.shodo.ink/@{organization}/{project}/
Authorization
First, issue Bearer tokens in the "API integration" settings page of Shodo's project.
Specify the token on Authorization header.
Authorization: Bearer {token}
Lint/Proofreading API
This is API to proofread Japanese texts.
API URL:https://api.shodo.ink/@{organization}/{project}/lint/
POST a Japanese body to the proofreading API. Up to 40,000 characters are allowed.
{
"body": "校正する本文"
}
Option:
type
: Specifybody
type astext
(text, Markdown),html
(HTML). (Default istext
)
Response
{
"lint_id": "6d639e5f-8bfe-43d7-ac24-8bb6b97ba936",
"monthly_amount": 1000000,
"current_usage": 116049,
"len_body": 8429,
"len_used": 8112
}
Shodo runs proofreading asynchronously.
The lint_id
is used to get results of proofreading.
For example, you can use httpie to call this API.
$ http -A bearer -a d8eb...3359 https://api.shodo.ink/@org/project/lint/ text="校正する本文"
Counting and caching
Shodo counts only Japanese sentences in the submitted body as the number of characters used. The number of characters will be less than the length of all submitted body.
Submitted sentences will be cached, so if the same sentence is submitted again, Shodo won't count them as monthly usage.
Each response of the proofreading API has the following meaning.
lint_id
: ID to get the result of the proofreading.monthly_amount
: Number of characters available in the API (per month).current_usage
: Number of characters used this month.len_body
: Length of Japanese sentences of the submitted body.len_used
: Used number of character (subtracting the cache).
For example, if all the cache is used, len_used
will be 0
.
The cache is valid for about 30 minutes, but the cache time is not guaranteed.
Please be assured that the cache of the text is managed in a way that it is not leaked or affected by other users.
HTML Input
In Shodo, you can use HTML in the body. When HTML is specified, the body text of block elements will be proofread. Please note that inline elements and attribute values are ignored. Also, the target of proofreading must be included within some HTML elements.
$ http ... body="<p>これは本文です</p>" type="html"