Team Dictionary
API key holder must be an admin for the team to access a team's dictionary.
Add terms such as jargon or product names to the custom dictionary so that Sapling will not give suggestions for them.
A team dictionary will apply to all members of the team. See Team Management for getting the IDs for a particular team.
Dictionary GET
Request Parameters
import requests
key = '<api-key>'
url = f'https://api.sapling.ai/api/v1/team/<team_id>/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)
https://api.sapling.ai/api/v1/team/<team_id>/dictionary?key=<key>
HTTP method: GET
<team_id>: String (UUID)
ID of a Sapling team.
<key>: String
32-character API key.
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>'
team_id = '<TEAM_ID>'
url = f'https://api.sapling.ai/api/v1/team/{team_id}/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/team/<team_id>/dictionary
HTTP method: POST
<team_id>: String (UUID)
ID referring to a Sapling team
key: String
32-character API key
entry: String
Case Sensitive word
case_sensitive: Optional Boolean
Defaults to false. If not case-sensitive, lower case, title case and all-caps will match.
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>'
team_id = '<TEAM_ID>'
entry_id = '<DICTIONARY_ENTRY_ID >'
url = f'https://api.sapling.ai/api/v1/team/{team_id}/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)
HTTP method: DELETE
https://api.sapling.ai/api/v1/team/<team_id>/dictionary/<dictionary_entry_id>
<team_id>: String (UUID)
ID referring to a Sapling team
<dictionary_entry_id>: String (UUID)
ID referring to a dictionary entry.
HTTP method: DELETE
Response Parameters
Empty, HTTP status code 204.