InvokeThingService

Last Updated on : 2025-10-10 06:54:07Copy for LLMView as MarkdownDownload PDF

Call this interface to set the property value for the specified device.

Instructions for use

When defining the product model service, the service invocation method has been set. Therefore, when this interface is called, IoT Platform will Identifier value, select the invocation method corresponding to the service.

  • Synchronous mode: IoT platform directly uses the RRPC synchronous mode to push requests, and the device returns an RRPC response message.

  • Asynchronous mode: IoT Platform uses asynchronous mode to push requests downstream, and devices use asynchronous mode to return results.

Request Parameters

Name Type Required Sample Values Description
Action String Yes InvokeThingService System defined parameters. Value: InvokeThingService.
Args String Yes {"param1":1} To enable the input parameter information of the service, the data format is JSON String, for example Args={"param1":1} . If this parameter is empty, you need to pass in Args={} .
Identifier String Yes Set The identifier of the service. Service of equipment Identifier view: In the product to which the device belongs function Definition view.
ProductKey String No A1BwAGV * * * * The ProductKey of the device to be used.
DeviceName String No Light The DeviceName of the device to which the service belongs.
IoTID String No **** 00100 The ID of the device to call the service. The ID issued by IoT platform for the device. The unique identifier of the device.

Note: When calling an API, in addition to the API-specific request parameters described in this topic, you must also pass in the common request parameters. For more information about common request parameters, see Common parameters.

Return data

Name Type Sample Values Description
Code String Iot.system.SystemException The error code returned when the call fails. For more information, see Error codes.
Data Struct The data returned when the call is successful.
MessageID String Abcabcabc1234 * * * * The ID of the service call sent by the cloud to the device.
Result String {"param1":1} The service is called synchronously and the call result is returned. This parameter is not returned when the service is called asynchronously.
ErrorMessage String System Exception Error information returned when the call fails.
RequestID String E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565 The unique identifier generated by the request.
Success Boolean True Whether the call was successful. ●True : The call was successful, but it does not mean that the called service was successfully executed. The implementation status is subject to the device log. ●False : The call failed.

Example

  • Request Example
curl 'https://si-d6e8******48958054.tuyacloud.com:8686/?Action=InvokeThingService&Args=%7B%22param%22%3A1%7D&Identifier=testService&SignatureNonce=62c43dfbf4984ee0b8333f209bc47d26&AccessKeyId=xMr9wgwXQLhv5AUa65o03mcD&SignatureMethod=HMAC-SHA1&Timestamp=2024-11-19T10%3A06%3A54Z&ProductKey=k1ymv1DuLfE&DeviceName=myTestDevice&Signature=vmP0RXgY2IVzKq%2FWRMy10RXKDhk%3D'
  • Normal Return Example
{
  "Data": {
    "Result": "{\"code\":200,\"data\":{},\"id\":\"100686\",\"message\":\"success\",\"version\":\"1.0\"}", 
    "MessageId": "abcabc123"
  }, 
  "RequestId": "A44C818E-FA7F-4765-B1E7-01D14AE01C6A", 
  "Success": true
}