Forbidden Words API
Create Forbidden Word Library
Basic Information
Endpoint: /forbidden_words
Method: POST
API Description: Upload a forbidden word list file to create a forbidden word dictionary.
Forbidden Word List File Format
A UTF-8 encoded text file with one forbidden word per line, each line not exceeding 10 characters, and no more than 10,000 lines. A total of 200 forbidden word dictionaries can be created.
File Example:
徳川家康
豊臣秀吉
織田信長Request Parameters
Body (form-data)
| Name | Type | Required | Description | Default Value |
|---|---|---|---|---|
| name | string | No | Name of the forbidden word dictionary | None |
| file | file | Yes | Sensitive word list file (UTF-8 encoded TXT format) | Required |
| lang_type | string | Yes | Language code | Required |
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | object | Data |
Request Example
curl -X POST '127.0.0.1:7100/forbidden_words' \
-F 'name=人物' \
-F 'file=@name.txt' \
-F 'lang_type=ja-JP'Response Example
{
"status": "00000",
"message": "success",
"data": "FW43DA3B90" // data is the forbidden word dictionary
}Forbidden Word Information List
Basic Information
Endpoint: /forbidden_words
Method: GET
API Description: Retrieve information about all forbidden word dictionaries.
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | object[] | Data |
| ├─ id | string | Forbidden word ID |
| ├─ name | string | Name of the forbidden word dictionary |
| ├─ lang_type | string | Language code |
| ├─ amount | int | Number of forbidden words |
| ├─ update_time | string | Last update time |
Request Example
curl -X GET '127.0.0.1:7100/forbidden_words'Response Example
{
"status": "00000",
"message": "success",
"data": [
{
"id": "FW43DA3B90",
"name": "人物",
"lang_type": "ja-JP",
"amount": 12,
"update_time": "2022-01-19 13:14:15"
}
]
}Delete Forbidden Word Dictionary
Basic Information
Endpoint: /forbidden_words/{forbidden_words_id}
Method: DELETE
API Description: Delete the forbidden word dictionary with the specified ID.
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | object | Data |
Request Example
curl -X DELETE '127.0.0.1:7100/forbidden_words/FW43DA3B90'Response Example
{
"status": "00000",
"message": "success",
"data": null
}Delete Forbidden Word Dictionary
Basic Information
Endpoint: /forbidden_words/{forbidden_words_id}
Method: DELETE
API Description: Delete the forbidden word dictionary with the specified ID.
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | object | Data |
Request Example
curl -X DELETE '127.0.0.1:7100/forbidden_words/FW43DA3B90'Response Example
{
"status": "00000",
"message": "success",
"data": null
}Update Forbidden Word Dictionary
Basic Information
Endpoint: /forbidden_words/{forbidden_words_id}
Method: PUT
Interface Description: Modify the name or the list of forbidden words in the forbidden word dictionary.
Request Parameters
Body (form-data)
| Name | Type | Required | Description | Default Value |
|---|---|---|---|---|
| name | string | No | Name of the forbidden word dictionary | None |
| file | file | No | Forbidden word list file | None |
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | object | Data |
Request Example
- Modify the Name of the Forbidden Word Dictionary
curl -X PUT '127.0.0.1:7100/forbidden_words/FW43DA3B90' \
-F 'name=NewName'- Update the Forbidden Word List File
curl -X PUT '127.0.0.1:7100/forbidden_words/FW43DA3B90' \
-F 'file=@new.txt'Response Example
{
"status": "00000",
"message": "success",
"data": "FW43DA3B90"
}Get Forbidden Word Dictionary Information
Basic Information
Endpoint: /forbidden_words/{forbidden_words_id}
Method: GET
API Description: Retrieve information for the specified forbidden word dictionary ID.
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | object | Data |
| ├─ id | string | Forbidden word dictionary ID |
| ├─ name | string | Forbidden word dictionary name |
| ├─ lang_type | string | Language code |
| ├─ file | string | Base64 encoded forbidden word file (UTF-8 encoded TXT) |
| ├─ amount | int | Number of forbidden words |
| ├─ update_time | string | Last update time |
Request Example
curl -X GET '127.0.0.1:7100/forbidden_words/FW43DA3B90'Response Example
{
"status": "00000",
"message": "success",
"data": {
"id": "FW43DA3B90",
"name": "newName",
"lang_type": "ja-JP",
"file": "<Base64 encoded content>",
"amount": 12,
"update_time": "2021-11-29 13:14:15"
}
}