Updates a given dictionary with new data and/or meta data.
The user must be authenticated and have write permissions to the associated site group.
Request
The request object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
String |
Yes |
The identifier of the dictionary to update. |
|
|
String |
No |
A brief description of the dictionary's purpose and function. |
|
|
String |
No |
A longer description of the dictionary's purpose and function. |
|
|
String (Binary) |
No |
The dictionary data, provided as a base-64 encoded Excel workbook. The Excel workbook must adhere to certain formatting rules . |
|
|
Object |
No |
The dictionary data, provided as a JSON object. The JSON object must adhere to certain formatting rules . |
The workbook and entries fields are mutually exclusive, only one of them can be provided.
See here for Excel workbook formatting rules, or here for the supported JSON syntax.
If workbook is provided and the workbook contains Japanese data, note that the workbook should not contain any phonetic run.aspx) data. Otherwise such data might be part of the data extracted from the workbook, and pollute the generated dictionaries. Possible ways to achieve this include, e.g., exporting the data to *.csv and then reimporting the data, or running a macro that deletes the phonetic run data.
Response
The response object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
String |
The identifier of the dictionary that was updated. |
|
|
String |
The name of the updated dictionary. |
|
|
Array of String |
If |
Examples
$ # If the dictionary data is provided as an Excel workbook,
$ # we first base-64 encode the binary data.
$ WORKBOOK=$(base64 -i myworkbook.xlsx)
$ # Now upload the new dictionary data to replace the dictionary data
$ # that was already there, if anything. Inspect the messages to verify
$ # that everything went well.
$ echo '{"dictionaryId":"12345","workbook":"'$WORKBOOK'"}' | cx.py /processing/dictionary/update -
{
"dictionaryId": "12345",
"name": "My dictionary",
}
$ # We can change the description or rename it, too.
$ cx.py /processing/dictionary/update '{"dictionaryId":"12345","name":"My new name","description":"My new description."}'
{
"dictionaryId": "12345",
"name": "My new name"
}
$ # The dictionary data resides in a file in JSON format.
$ cat mydictionary.json | jq .
{
"xyz-colors": {
"pear": "green",
"orange": "orange",
"apple": [
"green",
"red"
],
"coconut": "brown",
"banana": [
"yellow",
"brown"
]
},
"global-properties": {
"unique-count": 1,
"count": 2,
"swap-fields": true,
"value-normalization-flags": 4,
"key-normalization-flags": 4,
"mode": "overlap",
"tokenizer-context": "en"
}
}
$ # Now upload the new dictionary data to replace the dictionary data
$ # that was already there, if anything. Inspect the messages to verify
$ # that everything went well.
$ echo '{"dictionaryId":"123454321","entries":'"$(<mydictionary.json)"'}' | cx.py /processing/dictionary/update -
{
"dictionaryId": "123454321",
"name": "My silly dictionary",
}