Last Updated on : 2024-04-03 16:21:31download
IThingSmartRequest includes the common APIs for the server side.
The following APIs are available:
API description
API requests with session
<T> void requestWithApiName(String apiName, String version, Map<String, Object> postData, Class<T> object, final IThingDataCallback<T> callback);
Parameter description
| Parameter | Description |
|---|---|
| apiName | The name of the API. |
| version | The version of the API. |
| postData | The data sent by post. |
| object | The data object returned by the server. |
| callback | The callback. |
API description
API requests without session
<T> void requestWithApiNameWithoutSession(String apiName, String version, Map<String, Object> postData, Class<T> object, final IThingDataCallback<T> callback);
Parameter description
| Parameter | Description |
|---|---|
| apiName | The name of the API. |
| version | The version of the API. |
| postData | The data sent by post. |
| object | The data object returned by the server. |
| callback | The callback. |
Call the method ThingOSDevice.getRequestInstance().
Example
| API description | apiName | version | postData |
|---|---|---|---|
| Get country list | tuya.m.country.list | 1.0 | None |
Map<String, Object> postData = null;
ThingOSDevice.getRequestInstance().requestWithApiNameWithoutSession("tuya.m.country.list", "1.0", postData, String.class, new IThingDataCallback<String>() {
@Override
public void onSuccess(String result) {
Log.i("TAG" , result);
}
@Override
public void onError(String errorCode, String errorMessage) {
Log.i("TAG" , errorCode);
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback