ctwing Configuration#
Create Third-Party Application
Add Version After Entering
Connect ctwing
After downloading the SDK, unzip it and install the local jar from the lib directory to the Maven repository
mvn install:install-file -Dfile=./ag-sdk-biz-348700.tar.gz-20250109.153115-SNAPSHOT.jar -DgroupId=com.ctg.ag -DartifactId=ag-sdk-biz-348700.tar.gz -Dversion=20250109.153115-SNAPSHOT -Dpackaging=jar
mvn install:install-file -Dfile=./ctg-ag-sdk-core-2.8.0-20230508.100604-1.jar -DgroupId=com.ctg.ag -DartifactId=ctg-ag-sdk-core -Dversion=2.8.0-20230508.100604-1 -Dpackaging=jar
pom.xml
can also directly use systemPath
to add local dependencies
<dependency>
<groupId>com.ctg.ag</groupId>
<artifactId>ag-sdk-biz-348700.tar.gz</artifactId>
<version>20250109.153115-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ag-sdk-biz-348700.tar.gz-20250109.153115-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ctg.ag</groupId>
<artifactId>ctg-ag-sdk-core</artifactId>
<version>2.8.0-20230508.100604-1</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ctg-ag-sdk-core-2.8.0-20230508.100604-1.jar</systemPath>
</dependency>
Obtain MasterKey
on the Product Overview Page
Implementation#
Test Call to Get Device List
@Value("${ctWing.APP_KEY}")
private String appkey;
@Value("${ctWing.APP_SECRET}")
private String appsecret;
@Test
void ctwingTest() throws Exception {
AepDeviceManagementClient client = AepDeviceManagementClient.newClient()
.appKey(appkey).appSecret(appsecret)
.build();
QueryDeviceListRequest request = new QueryDeviceListRequest();
// set your request params here
request.setParamMasterKey("MasterKey"); // Obtain the parameter from the product overview
request.setParamProductId("ProductId"); // Product ID
request.setParamSearchValue(""); // single value
request.setParamPageNow(""); // single value
request.setParamPageSize(""); // single value
System.out.println(client.QueryDeviceList(request));
// more requests
client.shutdown();
}
https://iot.ctwing.cn/ability/#/api-online-editor?apiId=10251&catId=234