Reputation: 27904
So I am posting the below JSON to a Logic App via a Http-Request-Trigger.
{
"RequestMetaDataValue": {
"RequestMetaDataUuid": "33333333-3333-3333-3333-333333333333"
},
"OtherStuff": [{
"OtherStuffUuid": "11111111-1111-1111-1111-1111",
"OtherStuffString": "peanut"
},
{
"OtherStuffUuid": "e5dceac3-51cb-477b-b3a9-bd08f351cc0e",
"OtherStuffString": "banana"
}]
}
The Logic App parses the Json, so I can extract the RequestMetaDataUuid value. In this case "33333333-3333-3333-3333-333333333333".
I then use a Create Blob (action?) as seen here:
https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-azureblobstorage
And how it looks like in my Designer
So fairly straight forward.
Here's the issue.
If I resend the (same) Json, the blob/file gets overwritten in the blob.
For example, if I change
"OtherStuffUuid": "11111111-1111-1111-1111-1111",
to
"OtherStuffUuid": "aaaaaaaa-1111-1111-1111-1111",
The blob that originally had "OtherStuffUuid": "11111111-1111-1111-1111-1111" goes to never-never land. :(
If there anyway to prevent overwrite?
Is there anyway to check that the blob/file already exists (my preference) in the blob storage?
APPEND
Based on an answer, I tried to add the following pre-check.
Documentation here:
https://learn.microsoft.com/en-us/connectors/azureblob/#Get_Blob_Metadata_using_path
Get Blob Metadata using path Operation ID: GetFileMetadataByPath This operation retrieves blob metadata using path.
Required Parameters Blob path string Specify unique path to the blob Key: path
Returns Body BlobMetadata Blob metadata
Upvotes: 3
Views: 3693
Reputation: 1466
You can use the 'Get Blob Metadata using path' action to check for existence of the blob. You can then can use a condition (based on the status code of the get blob metadata action result) to run actions depending on whether the blob already exists.
Upvotes: 1