Queries the details of a parser. The details include the basic information, parsing script, status, and associated data source.
QPS limits
Each Alibaba Cloud account can run up to 10 queries per second (QPS).
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetParser |
The operation that you want to perform. Set the value to GetParser. |
ParserId | Integer | Yes | 1001 |
The ID of the parser. You can call the ListParser operation to query parsers and obtain the ID of the parser. |
IotInstanceId | String | No | iot-n8t*** |
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, see Common request parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | iot.system.SystemException |
The error code returned if the call fails. For more information, see Error codes. |
Data | Struct |
The details of the parser. |
|
DataSourceId | Long | 1003 |
The ID of the data source that is associated with the parser. |
Description | String | Forward data. |
The description of the parser. |
Name | String | DataParser |
The name of the parser. |
ParserId | Long | 1001 |
The ID of the parser. |
Script | String | var data = payload("json"); var h = data.items.Humidity.value; var t = data.items.Temperature.value; writeTsdb(1000,timestamp(),"temperature", t , {"deviceName":deviceName()}); writeTsdb(1000,timestamp(),"humidity", h , {"deviceName":deviceName()}); |
The parsing script that is released for the parser. |
ScriptDraft | String | var data = payload("json"); var h = data.items.Humidity.value; var t = data.items.Temperature.value; writeTsdb(1000,timestamp(),"temperature", t , {"deviceName":deviceName()}); writeTsdb(1000,timestamp(),"humidity", h , {"deviceName":deviceName()}); |
The draft of the parsing script. |
Status | String | STOP |
The status of the parser. Valid values:
|
UtcCreated | String | 2022-03-27T12:45:43.000Z |
The time when the parser was created. The time is displayed in UTC. Format: |
UtcModified | String | 2022-04-27T12:45:43.000Z |
The time when the parser was updated. The time is displayed in UTC. Format: |
ErrorMessage | String | A system exception occurred. |
The error message returned if the request fails. |
RequestId | String | E4C0FF92-2A86-41DB-92D3-73B60310D25E |
The ID of the request. |
Success | Boolean | true |
Indicates whether the call was successful.
|
Examples
Sample requests
http(s)://iot.cn-shanghai.aliyuncs.com/?Action=GetParser
&ParserId=1001
&<Common request parameters>
Sample success responses
XML
format
<GetParserResponse>
<RequestId>E4C0FF92-2A86-41DB-92D3-73B60310D25E</RequestId>
<Data>
<Status>STOP</Status>
<Script>var data = payload("json"); var h = data.items.Humidity.value; var t = data.items.Temperature.value; writeTsdb(1000,timestamp(),"temperature", t , {"deviceName":deviceName()}); writeTsdb(1000,timestamp(),"humidity", h , {"deviceName":deviceName()});</Script>
<Description>Forward data. </Description>
<UtcCreated>2022-03-27T12:45:43.000Z</UtcCreated>
<ScriptDraft>var data = payload("json"); var h = data.items.Humidity.value; var t = data.items.Temperature.value; writeTsdb(1000,timestamp(),"temperature", t , {"deviceName":deviceName()}); writeTsdb(1000,timestamp(),"humidity", h , {"deviceName":deviceName()});</ScriptDraft>
<UtcModified>2022-04-27T12:45:43.000Z</UtcModified>
<ParserId>1001</ParserId>
<DataSourceId>1003</DataSourceId>
<Name>DataParser</Name>
</Data>
<Success>true</Success>
</GetParserResponse>
JSON
format
{
"RequestId": "E4C0FF92-2A86-41DB-92D3-73B60310D25E",
"Data": {
"Status": "STOP",
"Script": "var data = payload(\"json\"); var h = data.items.Humidity.value; var t = data.items.Temperature.value; writeTsdb(1000,timestamp(),\"temperature\", t , {\"deviceName\":deviceName()}); writeTsdb(1000,timestamp(),\"humidity\", h , {\"deviceName\":deviceName()});",
"Description": "Forward data.",
"UtcCreated": "2022-03-27T12:45:43.000Z",
"ScriptDraft": "var data = payload(\"json\"); var h = data.items.Humidity.value; var t = data.items.Temperature.value; writeTsdb(1000,timestamp(),\"temperature\", t , {\"deviceName\":deviceName()}); writeTsdb(1000,timestamp(),\"humidity\", h , {\"deviceName\":deviceName()});",
"UtcModified": "2022-04-27T12:45:43.000Z",
"ParserId": 1001,
"DataSourceId": 1003,
"Name": "DataParser"
},
"Success": true
}