Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.41k stars 4.8k forks source link

Please document how to grab the computed ETag after updating the twin #20060

Closed uriel-kluk closed 3 years ago

uriel-kluk commented 3 years ago

[Enter feedback here] The UpdateDigitalTwinAsync returns an HTTP Response object, but it is not clear how to grab the computed ETag. The workaround is to do a new Read, but the extra trip is undesirable.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @sourabhguha, @inesk-vt.

Issue Details
[Enter feedback here] The **UpdateDigitalTwinAsync** returns an HTTP Response object, but it is not clear how to grab the computed ETag. The workaround is to do a new Read, but the extra trip is undesirable. --- #### Document Details ⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.* * ID: be700a53-abbf-f28d-671e-2eaa058a8ef0 * Version Independent ID: f89f1c40-3007-1bd8-2e98-d7c8c2f75d9e * Content: [DigitalTwinsClient.UpdateDigitalTwinAsync(String, JsonPatchDocument, Nullable<ETag>, CancellationToken) Method (Azure.DigitalTwins.Core) - Azure for .NET Developers](https://docs.microsoft.com/en-us/dotnet/api/azure.digitaltwins.core.digitaltwinsclient.updatedigitaltwinasync?view=azure-dotnet) * Content Source: [xml/Azure.DigitalTwins.Core/DigitalTwinsClient.xml](https://github.com/Azure/azure-docs-sdk-dotnet/blob/master/xml/Azure.DigitalTwins.Core/DigitalTwinsClient.xml) * Service: **azure** * GitHub Login: @CamSoper * Microsoft Alias: **casoper**
Author: uriel-kluk
Assignees: -
Labels: `Client`, `Digital Twins`, `Docs`, `Service Attention`, `customer-reported`, `needs-team-attention`, `needs-triage`, `question`
Milestone: -
jsquire commented 3 years ago

Thank you for your feedback. Tagging and routing to the team best able to assist.

timtay-microsoft commented 3 years ago

Hi @uriel-kluk you do not need to do a GetDigitalTwin after UpdateDigitalTwin in order to get the ETag. Within the Http headers of the Response object that UpdateDigitalTwin returns should be the new ETag for your digital twin after the update

timtay-microsoft commented 3 years ago

From the swagger, you can see that this ETag is returned for you:

"responses": {
  "204": {
    "description": "Success",
    "headers": {
      "ETag": {
        "description": "Weak Etag.",
        "type": "string"
      }
    }
  }
}