Skip to content

Instantly share code, notes, and snippets.

@mansouryaacoubi
Last active January 10, 2022 14:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mansouryaacoubi/96cba038bb781f5c67785e184275cf09 to your computer and use it in GitHub Desktop.
Save mansouryaacoubi/96cba038bb781f5c67785e184275cf09 to your computer and use it in GitHub Desktop.
Duden Grammar-Check using unofficial Mentor-API (Grammatik, Rechtschreibung)
#!/bin/sh
curl 'https://mentor.duden.de/api/grammarcheck?_format=json' -H 'content-type: application/json' --data-binary '{"text":"Bitte geben Sie die nächste zu zuweisende sendung ein."}' --compressed
@TheMrPoseidon
Copy link

Variant for using with premium account

export user=USERNAME
export pass=PASSWORD
export token=$(curl --location --request POST 'https://login.duden.de/oxauth/restv1/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'scope=openid' \
--data-urlencode "username=$user" \
--data-urlencode "password=$pass" \
--data-urlencode 'client_id=@!3F52.C0C5.DA68.427A!0001!E8C1.AA31!0008!43EF.2EC2.4A53.02F0' \
--data-urlencode 'client_secret=oZqh148j285o1CedMgBtrmGz' -N 2> /dev/null | jq '.access_token' -r)

curl --location --request POST 'https://mentor.duden.de/api/grammarcheck?_format=json' \
--header "application-authorization: Bearer $token" \
--header 'Content-Type: application/json' \
--data-raw '{
    "text": "Das ist echt unglaublich",
    "userInteraction": null,
    "documentID": "plugin-1234567890123-abcdefghij",
    "maxProposals": 7
}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment