PowerShell 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.
PowerShell
/api/v1/edits
$params = @{"key"="<API_KEY>";
"text"="Lets get started!";
"session_id"="Test Document UUID";
}
$url = "https://api.sapling.ai/api/v1/edits"
Invoke-WebRequest -Uri $url -Method POST -Body ($params|ConvertTo-Json) -ContentType "application/json"
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 PowerShell
PowerShell is Microsoft's command-line shell and scripting language for Windows, which is where it sees most adoption. It is the default automation tool for Windows-based scripts. PowerShell additionally supports Linux and macOS.