Calls a data analysis API operation to retrieve a SQL query result.
QPS limits
You can call this API operation up to one time per second per account.
The RAM users of an Alibaba Cloud account share the quota of the account.
Debugging
Request Parameters
Parameter | Type | Required | Example | Description |
Action | String | Yes | InvokeDataAPIService | The operation that you want to perform. Set the value to InvokeDataAPIService. |
ApiSrn | String | Yes | acs:iot:*:127103983461****:serveapi/device/getDeviceCountByStatus2 | The globally unique identifier (GUID) of the API operation. The value of the ApiSrn parameter is returned when you call the CreateDataAPIService operation to create an API operation. Syntax: Example: Description:
|
Param.N.ParamType | String | No | VARCHAR | The data type. Valid values:
Note
|
Param.N.ListParamValue.N | RepeatList | No | ["1","2","3"] | The values of the ARRAY parameter. The array can contain only elements of the same data type. If you specify numeric values in the array, make sure that all elements are numeric values. Note All elements are saved as strings. IoT Platform converts the strings into a Java Database Connectivity (JDBC) object based on the value of the Param.N.ListParamType parameter. |
Param.N.ListParamType | String | No | VARCHAR | The data type of parameter values. Valid values:
For more information, see JDBCType. |
Param.N.ParamName | String | No | status | The name of the input parameter. This parameter value must be the same as the value that you specified for the RequestParam.N.Name parameter when you called the CreateDataAPIService operation to create an API operation. |
Param.N.ParamValue | String | No | 1 | The value of the input parameter.
|
IotInstanceId | String | No | iot-v64******** | The ID of the instance. You can view the ID of the instance on the Overview page in the IoT Platform console. Important
For more information, see Overview. |
In addition to the preceding operation-specific request parameters, you must configure common request parameters when you call this operation. For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
Code | String | Success | The error code returned if the call fails. For more information about error codes, see Error codes. |
Data | Struct | The query result returned if the call is successful. | |
ApiSrn | String | acs:iot:*:127103983461****:serveapi/device/getDeviceCountByStatus2 | The GUID of the API operation. Example: Description:
|
FieldNameList | List | {"FieldNameList": ["deviceCount"]} | The list of returned fields. The value of this parameter is the same as the value that you specified for the ResponseParam.N.Name parameter when you called the CreateDataAPIService operation to create an API operation. |
PageNo | Integer | 0 | The page number. Pages start from page 1. Default value: 1. If you want to specify a custom page number, we recommend that you add the RequestParam.N.PageNo parameter as a request parameter to the InvokeDataAPIService operation. |
PageSize | Integer | 1 | The number of entries per page. If you want to specify a custom page size, we recommend that you add the RequestParam.N.PageSize parameter as a request parameter to the InvokeDataAPIService operation. |
ResultList | List | [{"deviceCount": 47}] | The result of the SQL query. The value of this parameter is the same as the value that you specified for the ResponseParam.N.Name parameter when you called the CreateDataAPIService operation to create an API operation. Description of the
|
TotalSize | Integer | 12 | The total number of rows in the query result. |
ErrorMessage | String | The request parameters are invalid. | The error message returned if the call fails. |
RequestId | String | E68FE5DC-4D7B-4987-B785-DF8C6F191F5D | The ID of the request. |
Success | Boolean | true | Indicates whether the call was successful. Valid values:
|
Examples
Sample requests
http(s)://iot.cn-shanghai.aliyuncs.com/? Action=InvokeDataAPIService
&ApiSrn=acs:iot:*:127103983461****:serveapi/device/getDeviceCountByStatus2
&Param.1.ParamName=status
&Param.1.ParamValue=1
&<Common request parameters>Sample success responses
XML format
<InvokeDataAPIServiceResponse>
<RequestId>E68FE5DC-4D7B-4987-B785-DF8C6F191F5D</RequestId>
<Data>
<ApiSrn>acs:iot:*:127103983461****:serveapi/device/getDeviceCountByStatus2</ApiSrn>
<PageSize>1</PageSize>
<PageNo>0</PageNo>
<TotalSize>12</TotalSize>
<FieldNameList>
<FieldNameList>deviceCount</FieldNameList>
</FieldNameList>
<ResultList>
<ResultList>
<deviceCount>47</deviceCount>
</ResultList>
</ResultList>
</Data>
<Success>true</Success>
</InvokeDataAPIServiceResponse>JSON format
{
"RequestId": "E68FE5DC-4D7B-4987-B785-DF8C6F191F5D",
"Data": {
"ApiSrn": "acs:iot:*:127103983461****:serveapi/device/getDeviceCountByStatus2",
"PageSize": 1,
"PageNo": 0,
"TotalSize": 12,
"FieldNameList": {
"FieldNameList": ["deviceCount"]
},
"ResultList": {
"ResultList": [{"deviceCount": 47}]
}
},
"Success": true
}Error codes.
For a list of error codes, visit the API Error Center.