You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-file-upload-dotnet.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,23 +20,23 @@ This how-to contains two sections:
20
20
21
21
## Upload a file from a device application
22
22
23
-
Follow this procedure to upload a file from a device to IoT Hub:
23
+
Follow this procedure to upload a file from a device to IoT hub:
24
24
25
-
* Connect to IoT Hub
26
-
* Get a SAS URI from IoT Hub
25
+
* Connect to IoT hub
26
+
* Get a SAS URI from IoT hub
27
27
* Upload the file to Azure storage
28
28
* Notify IoT hub of the file upload status
29
29
30
-
### Connect to IoT Hub
30
+
### Connect to IoT hub
31
31
32
-
Supply the IoT Hub primary connection string to [DeviceClient](/dotnet/api/microsoft.azure.devices.client.deviceclient) using the [CreateFromConnectionString](/dotnet/api/microsoft.azure.devices.client.deviceclient.createfromconnectionstring?#microsoft-azure-devices-client-deviceclient-createfromconnectionstring(system-string)) method. `AMQP` is the default transport protocol.
32
+
Supply the IoT hub primary connection string to [DeviceClient](/dotnet/api/microsoft.azure.devices.client.deviceclient) using the [CreateFromConnectionString](/dotnet/api/microsoft.azure.devices.client.deviceclient.createfromconnectionstring?#microsoft-azure-devices-client-deviceclient-createfromconnectionstring(system-string)) method. `AMQP` is the default transport protocol.
Call [GetFileUploadSasUriAsync](/dotnet/api/microsoft.azure.devices.client.deviceclient.getfileuploadsasuriasync) to get a file upload details. The SAS URI is used in the next step to upload a file from a device to Blob Storage.
42
42
@@ -72,9 +72,9 @@ await blockBlobClient.UploadAsync(fileStreamSource, new BlobUploadOptions());
72
72
73
73
### Notify IoT hub of the file upload status
74
74
75
-
Use [CompleteFileUploadAsync](/dotnet/api/microsoft.azure.devices.client.deviceclient.completefileuploadasync) to notify IoT Hub that the device client completed the upload, passing a [FileUploadCompletionNotification](/dotnet/api/microsoft.azure.devices.client.transport.fileuploadcompletionnotification) object. The `IsSuccess` flag indicates whether or not the upload was successful. After being notified, IoT Hub will release resources associated with the upload (the SAS URI).
75
+
Use [CompleteFileUploadAsync](/dotnet/api/microsoft.azure.devices.client.deviceclient.completefileuploadasync) to notify IoT hub that the device client completed the upload, passing a [FileUploadCompletionNotification](/dotnet/api/microsoft.azure.devices.client.transport.fileuploadcompletionnotification) object. The `IsSuccess` flag indicates whether or not the upload was successful. After being notified, IoT hub will release resources associated with the upload (the SAS URI).
76
76
77
-
If file upload notifications are enabled, IoT Hub sends a file upload notification message to backend services that are configured for file upload notification.
77
+
If file upload notifications are enabled, IoT hub sends a file upload notification message to backend services that are configured for file upload notification.
## Receive a file upload notification in a backend application
99
99
100
-
You can create a backend service to receive file upload notification messages from IoT Hub.
100
+
You can create a backend service to receive file upload notification messages from IoT hub.
101
101
102
102
The [ServiceClient](/dotnet/api/microsoft.azure.devices.serviceclient) class contains methods that services can use to receive file upload notifications.
103
103
@@ -110,7 +110,7 @@ To receive file upload notification:
Call [getFileUploadSasUri](/java/api/com.microsoft.azure.sdk.iot.device.deviceclient?#com-microsoft-azure-sdk-iot-device-deviceclient-getfileuploadsasuri(com-microsoft-azure-sdk-iot-deps-serializer-fileuploadsasurirequest)) to obtain a [FileUploadSasUriResponse](/java/api/com.microsoft.azure.sdk.iot.deps.serializer.fileuploadsasuriresponse) object.
@@ -87,13 +87,13 @@ String fullFileName = "Path of the file to upload";
87
87
blobClient.uploadFromFile(fullFileName);
88
88
```
89
89
90
-
## Send file upload status notification to IoT Hub
90
+
## Send file upload status notification to IoT hub
91
91
92
92
Send an upload status notification to IoT hub after a file upload attempt.
93
93
94
94
Create a [FileUploadCompletionNotification](/java/api/com.microsoft.azure.sdk.iot.deps.serializer.fileuploadcompletionnotification?#com-microsoft-azure-sdk-iot-deps-serializer-fileuploadcompletionnotification-fileuploadcompletionnotification(java-lang-string-java-lang-boolean)) object. Pass the `correlationId` and `isSuccess` file upload success status. Pass an `isSuccess``true` value when file upload was successful, `false` when not.
95
95
96
-
`FileUploadCompletionNotification` must be called even when the file upload fails. IoT Hub has a fixed number of SAS URI allowed to be active at any given time. Once you're done with the file upload, you should free your SAS URI so that other SAS URI can be generated. If a SAS URI isn't freed through this API, then it frees itself eventually based on how long SAS URI are configured to live on an IoT Hub.
96
+
`FileUploadCompletionNotification` must be called even when the file upload fails. IoT hub has a fixed number of SAS URI allowed to be active at any given time. Once you're done with the file upload, you should free your SAS URI so that other SAS URI can be generated. If a SAS URI isn't freed through this API, then it frees itself eventually based on how long SAS URI are configured to live on an IoT hub.
97
97
98
98
This example passes a successful status.
99
99
@@ -116,7 +116,7 @@ You can create a backend application to receive file upload notifications.
116
116
117
117
To create a file upload notification application:
118
118
119
-
* Connect to the IoT Hub service client
119
+
* Connect to the IoT hub service client
120
120
* Check for a file upload notification
121
121
122
122
The [ServiceClient](/java/api/com.azure.core.annotation.serviceclient) class contains methods that services can use to receive file upload notifications.
* Create a [getFileUploadNotificationReceiver](/java/api/com.microsoft.azure.sdk.iot.service.fileuploadnotificationreceiver) object
141
-
* Use [open](/java/api/com.microsoft.azure.sdk.iot.service.fileuploadnotificationreceiver?#com-microsoft-azure-sdk-iot-service-fileuploadnotificationreceiver-open()) to connect to IoT Hub
141
+
* Use [open](/java/api/com.microsoft.azure.sdk.iot.service.fileuploadnotificationreceiver?#com-microsoft-azure-sdk-iot-service-fileuploadnotificationreceiver-open()) to connect to IoT hub
142
142
* Call [receive](/java/api/com.microsoft.azure.sdk.iot.service.fileuploadnotificationreceiver?#com-microsoft-azure-sdk-iot-service-fileuploadnotificationreceiver-receive()) to check for the file upload status. This method returns a [fileUploadNotification](/java/api/com.microsoft.azure.sdk.iot.service.fileuploadnotification) object. If an upload notice is received, you can view upload status fields using [fileUploadNotification](/java/api/com.microsoft.azure.sdk.iot.service.fileuploadnotification) methods.
Use [getBlobSharedAccessSignature](/javascript/api/azure-iot-device/client?#azure-iot-device-client-getblobsharedaccesssignature) to get the linked storage account SAS token from IoT Hub.
52
+
Use [getBlobSharedAccessSignature](/javascript/api/azure-iot-device/client?#azure-iot-device-client-getblobsharedaccesssignature) to get the linked storage account SAS token from IoT hub.
53
53
54
54
For example:
55
55
@@ -71,7 +71,7 @@ To upload a file from a device to IoT hub:
71
71
2. Construct the blob URL
72
72
3. Create a [BlockBlobClient](/javascript/api/@azure/storage-blob/blockblobclient) for file upload to Blob Storage
73
73
4. Call [uploadFile](/javascript/api/@azure/storage-blob/blockblobclient?#@azure-storage-blob-blockblobclient-uploadfile) to upload the file to Blob Storage
74
-
5. Call [notifyBlobUploadStatus](/javascript/api/azure-iot-device/client?#azure-iot-device-client-notifyblobuploadstatus) to notify IoT Hub that the upload succeeded or failed
74
+
5. Call [notifyBlobUploadStatus](/javascript/api/azure-iot-device/client?#azure-iot-device-client-notifyblobuploadstatus) to notify IoT hub that the upload succeeded or failed
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-file-upload-python.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,7 +96,7 @@ try:
96
96
return (True, result)
97
97
98
98
exceptFileNotFoundErroras ex:
99
-
# catch file not found and add an HTTP status code to return in notification to IoT Hub
99
+
# catch file not found and add an HTTP status code to return in notification to IoT hub
100
100
ex.status_code =404
101
101
return (False, ex)
102
102
@@ -107,7 +107,7 @@ except AzureError as ex:
107
107
108
108
### Notify IoT hub of upload status
109
109
110
-
Use [notify_blob_upload_status](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-notify-blob-upload-status) to notify IoT hub of the status of the Blob Storage operation. Pass the `correlation_id` obtained by the `get_storage_info_for_blob` method. The `correlation_id` is used by IoT Hub to notify any service that might be listening for a notification regarding the status of the file upload task.
110
+
Use [notify_blob_upload_status](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-notify-blob-upload-status) to notify IoT hub of the status of the Blob Storage operation. Pass the `correlation_id` obtained by the `get_storage_info_for_blob` method. The `correlation_id` is used by IoT hub to notify any service that might be listening for a notification regarding the status of the file upload task.
111
111
112
112
This example notifies IoT hub of a successful file upload:
0 commit comments