After the business cooperation is formed, our company will give the customer appId and appSecret. Please keep appSecret properly.
The customer obtains the token through appId and appSecret, and puts the token in the header to request the corresponding interface.
After duix obtains the token and other request data sets, it will first conduct security verification and other verifications. After a series of verifications are passed, the data request sent this time will be processed. The parameter format returned by the platform is as follows:
field | type | Required | remark |
---|---|---|---|
code | String | Y | Response code |
message | String | N | Description information of success/error |
data | object | N | Specific content returned |
success | Boolean | Y | Success or not |
Unless otherwise specified in the following text, the interpretation of return values refers to the internal structure of data.
error code | Description |
---|---|
0 | normal |
-1 | fail |
1005 | token cannot be empty |
1006 | Token failure |
1007 | Script information does not exist |
1009 | Insufficient user availability |
2002 | Session information does not exist |
40001 | Invalid appid or appscrect |
40002 | internal error |
When docking with the duix-openapi-v2 platform, you need to generate your own token by referring to the following methods:
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.8.3</version>
</dependency>
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import java.util.Calendar;
import java.util.Date;
/**
* Create Signature
*
* @param appId Issued to
* @param secret secret
* @param exp Expiration time: in seconds
* @return
*/
public static String createSig(String appId,String secret,int exp){
Calendar nowTime=Calendar.getInstance();
nowTime.add(Calendar.SECOND,exp);
Date expiresDate=nowTime.getTime();
return JWT.create()
//Release time
.withIssuedAt(new Date())
//effective time
.withExpiresAt(expiresDate)
//load
.withClaim("appId",appId)
//encryption
.sign(Algorithm.HMAC256(secret));
}
Interface address:
/duix-openapi-v2/sdk/checkSig
initiate API request: GET
Request data type: application/json
Response data type: application/json
Verify the validity of the token and return the real-time interaction ws connection address of the digital person
name | type | Parameter transmission method | Description |
---|---|---|---|
sig | String | Query | token |
name | type | Description |
---|---|---|
appId | String | appId |
wsService | String | Real time interactive ws address for digital humans |
Management HTTP requests have a common convention that requires passing tokens in the request header
/duix-openapi-v2/v1/getconcurrentNumber
GET
Interface description:
Query the concurrency of a certain APP
name | type | Parameter transmission method | Description |
---|---|---|---|
appId | String | Query | APPID |
Response Parameter:
name | type |
---|---|
code | String |
data | ConcurrentStatus |
cropId | String |
totalConcurrentNumber | integer(int32) |
userConcurrentNumber | integer(int32) |
message | String |
success | boolean |
Response Example:
{
"code": "",
"data": {
"cropId": "",
"totalConcurrentNumber": 0,
"userConcurrentNumber": 0
},
"message": "",
"success": true
}
/duix-openapi-v2/v1/getconcurrentList
GET
Query the list of "in call" conversations on a certain app.
name | type | Parameter transmission method | Description |
---|---|---|---|
appId | String | Query | APPID |
/duix-openapi-v2/v1/distroyCallSessionsByAppId
GET
Close all sessions under a certain app
name | type | Parameter transmission method | Description |
---|---|---|---|
appId | String | Query | APPID |
{
"code": "",
"data": "",
"message": "",
"success": true
}
/duix-openapi-v2/v1/sessionStop
GET
name | type | Parameter method | Description |
---|---|---|---|
uuid | String | Query | start-complete returned by the event sessionId |
Field | Type | Description | Required |
---|---|---|---|
sid | String | Your user ID, generated when you create a user. You can view it in the account information. | Y |
dh-code | String | The serial number is generated when each digital human is created and can be viewed in the overview. | Y |
dh-question | String | content questions | Y |
dh-conversation-id | String | Session id, a unique identifier | Y |
dh-context | String | Regarding the contextual information generated during this session, this information is stringified JSON format data. | N |
{
"sid": "100003",
"dh-code": "187265485019156480",
"dh-question": "who are you?",
"dh-conversation-id": "0513e935-041f-48e0-9330-652ef4194511",
"dh-context": "{}"
}