This topic describes the TingWu Java SDK and explains how to use it to quickly call the service.
Prerequisites
To grant temporary access permissions to third-party applications or users, or want to strictly control risky operations such as accessing or deleting sensitive data, you can use a temporary authentication token.Compared to a long-term API key, a temporary authentication token is valid for only a short period (60 seconds) and offers higher security. It is suitable for temporary call scenarios and can effectively reduce the risk of API key leaks.Usage: In your code, replace the API key used for authentication with the obtained temporary authentication token.
- Install the latest version of the DashScope SDK. The DashScope SDK version must be 2.21.1 or later.
API reference
TingWuParam.java
This class is used for parameter configuration. The following table lists the main parameters for creating a task, using Automotive Service Insights as an example. For more information about the parameters, see the Automotive Service Insights API Reference or the Car Buyer Portrait API Reference.
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| model | string | Yes | Defines the business type.For specific parameters, see the API reference. | tingwu-automotive-service-insights |
| input | object | Yes | Passes relevant business parameters. | |
| input.fileUrl | string | Choose one of three | The OSS URL of the file to be analyzed. Used for SDK calls. | https://.oss-cn-hangzhou.aliyuncs.com/%E8%AF%95%E9%A9%BE%E6%A1%88%E4%BE%8Bsmall.wav?OSSAccessKeyId=YOUR_ACCESS_KEY_ID&Expires=&Signature=YOUR_SIGNATURE |
| input.text | string | The text to be analyzed. | Each line must be in the following format:${Speaker Name}: ${Speaker Content}For example: | |
| input.dataId | string | Associates a task that has been uploaded and parsed. | ||
| input.appId | string | Yes | Application ID. | |
| input.task | string | Yes | Defines the task type:
| createTask |
| parameters | object | No | Request parameters. If a null object is passed, the published configuration items are reused.For specific parameters, see the API reference. |
Example code
TingWu.java
- This is the HTTP service interface class for TingWu.
- This class sends a request and returns a response.
Response
The following table lists the main response parameters, using Automotive Service Insights as an example. For more information, see the Automotive Service Insights API Reference or the Car Buyer Portrait API Reference.
Name | Type | Description | Example |
|---|---|---|---|
output | object | ||
output.dataId | string | Task ID. | |
output.status | string |
| 0 |
usage | object | ||
code | string | Error code. | InvalidParameter |
message | string | Error message. | Agent Input text format error. |
request_id | string | Request ID. | f97ee37d-0f9c-9b93-b6bf-bd263a232bf9 |