Skip to main content

Dictionary

Add terms such as industry-specific jargon or product names to your dictionary so that Sapling will ignore these terms. The dictionary can also be managed in your web dashboard.

Dictionary GET

Request Parameters

https://api.sapling.ai/api/v1/dictionary?key=<key>

HTTP method: GET

<key>: String
32-character API key

import requests

key = '<api-key>'

url = f'https://api.sapling.ai/api/v1/dictionary?key={key}'

try:
resp = requests.get(url)
resp_json = resp.json()
if 200 <= resp.status_code < 300:
print('Dictionary entries: ', resp_json)
else:
print('Error: ', resp_json)
except Exception as e:
print('Error: ', e)

Response Parameters

JSON array of dictionary entries.

Dictionary entry structure:

{
"id": <str, UUID>, // Opaque id, used for deletion
"entry": <str>, // Dictionary entry (case-sensitive)
"created_at": <str, date> // e.g. "Wed, 07 Oct 2020 21:15:47 GMT"
"updated_at": <str, date> // e.g. "Wed, 07 Oct 2020 21:15:47 GMT"
}

Dictionary POST

Request Parameters

import requests

key = '<api-key>'

url = 'https://api.sapling.ai/api/v1/dictionary'
data = {
'key': key,
'entry': 'foobarbaz',
}

try:
resp = requests.post(url, json=data)
resp_json = resp.json()
if 200 <= resp.status_code < 300:
print('Entry: ', resp_json)
else:
print('Error: ', resp_json)
except Exception as e:
print('Error: ', e)

https://api.sapling.ai/api/v1/dictionary

HTTP method: POST

key: String
32-character API key

entry: String
Word to be added to the dictionary.

case_sensitive: Optional Boolean
Whether or not word is case sensitive. Defaults to false.

Response Parameters

JSON, the response contains the created dictionary entry

Dictionary Entry Structure:

{
"id": <str, UUID>, // Opaque id, used for deletion
"entry": <str>, // Word in dictionary
"case_sensitive": <bool>, // Whether or not entry is case sensitive
"created_at": <str, date> // e.g. "Wed, 07 Oct 2020 21:15:47 GMT"
"updated_at": <str, date> // e.g. "Wed, 07 Oct 2020 21:15:47 GMT"
}

Dictionary DELETE

Request Parameters

import requests

key = '<api-key>'
entry_id = '<DICTIONARY_ENTRY_ID>'

url = f'https://api.sapling.ai/api/v1/dictionary/{entry_id}'
data = {
'key': key,
}

try:
resp = requests.delete(url, json=data)
if 200 <= resp.status_code < 300:
print('Success')
else:
resp_json = resp.json()
print('Error: ', resp_json)
except Exception as e:
print('Error: ', e)

https://api.sapling.ai/api/v1/dictionary/<dictionary_entry_id>

HTTP method: DELETE

<dictionary_entry_id>: String (UUID)
ID of dictionary entry.

Response Parameters

Empty, HTTP status code 204.