Upload a Custom Prompt
Upload a custom prompt.
Request URL
POST {base_url}/{api_path}/custom_prompt/upload?access_token={access_token}
Request parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| file | Yes | File | The custom prompt file. Note: Only a
file in ".wav", ".mp3" or ".gsm" format is allowed, and the file
size must not exceed 8MB. |
| is_check | No | String | The operation mode. Note: This parameter is required and
available only when the parameters old_file and
new_file
are
not included in the request.Valid value:
|
| old_file | No | String | The filename of the prompt to be replaced, including the file
extension (e.g., "demo.wav"). Note:
|
| new_file | No | String | The new filename used to update the filename of the replaced
prompt, including the file extension (e.g., "demo.wav"). Note: The file extension must be the same as the
old file. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| errcode | Integer | Returned error code.
Note: You can check the error code and
error message in Error Code and Error Message.
|
| errmsg | String | Returned message.
|
| exist_type | String | The type of the existing custom prompt. Note: If the parameter returns an empty
string, it indicates that no duplicate filename
exists.
|
| upper_limited | Integer | The limit for custom prompt files. Note: This parameter is returned only when the number of custom
prompt files reaches the limit. |
Examples
Request example
- Check whether the filename of the custom prompt "demo.wav" already exists.
POST /openapi/v1.0/custom_prompt/upload?access_token=8MW5SHkimQ5XFufE93ErtTzKmNfc5UHp HTTP/1.1 Host: 192.168.5.150:8088 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="file"; filename="/D:/prompt/demo.wav" Content-Type: audio/wav (binary data) ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="is_check" ask ------WebKitFormBoundary7MA4YWxkTrZu0gW--Figure 1. Request example 1 in Postman
- Upload the custom prompt file "demo.wav".
POST /openapi/v1.0/custom_prompt/upload?access_token=8MW5SHkimQ5XFufE93ErtTzKmNfc5UHp HTTP/1.1 Host: 192.168.5.150:8088 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="file"; filename="/D:/prompt/demo.wav" Content-Type: audio/wav (binary data) ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="is_check" force ------WebKitFormBoundary7MA4YWxkTrZu0gW--Figure 2. Request example 2 in Postman
Response example
HTTP/1.1 200 OK { "errcode": 0, "errmsg": "SUCCESS", "exist_type": "" }