Rust grammar checker quickstart
Send text to the edits endpoint. Sapling returns suggested replacements with character offsets so your application can review or apply each correction.
No language-specific SDK is required. The example uses a standard or commonly used HTTP client to call Sapling's JSON API.
Rust
/api/v1/edits
Rust does not have a standard HTTP or socket library. A popular library for application development is reqwest.
fn main() {
let mut map = HashMap::new();
map.insert("key", "API_KEY");
map.insert("text", "Lets get started");
map.insert("session_id", "Test Document UUID");
let client = reqwest::Client::new();
let res = client.post("https://api.sapling.ai/api/v1/edits")
.json(&map)
.send()
.await?;
}
Example response
application/json
{
"edits": [
{
"start": 0,
"end": 4,
"replacement": "Let's",
"sentence": "Lets get started!",
"error_type": "R:OTHER"
}
]
}
Each edit identifies the source range and replacement text. Preserve the original offsets when applying more than one edit.
About Rust
Rust is a programming language designed with comparable performance to C or C++, but with additional emphasis on code safety. Rust compilers do additional object reference and thread safety checks to prevent references to invalid memory or concurrency issues.