This API provides a way to retrieve the complete device Twin properties on-demand.


#include "azure-iot-sdk-c/iothub_client/inc/iothub_device_client.h"

IOTHUB_CLIENT_RESULT IoTHubDeviceClient_GetTwinAsync(
  IOTHUB_DEVICE_CLIENT_HANDLE         iotHubClientHandle,
  void *                              userContextCallback


  • iotHubClientHandle The handle created by a call to the create function.

  • deviceTwinCallback The callback invoked to provide the complete Device Twin properties once its retrieval is completed by the client. If any failures occur, the callback is invoked passing NULL as payLoad and zero as size.

  • userContextCallback User specified context that will be provided to the callback. This can be NULL.

NOTE: The application behavior is undefined if the user calls the IoTHubClient_LL_Destroy function from within any callback.

Return Value

IOTHUB_CLIENT_OK upon success or an error code upon failure.