Home > Net >  Setting Azure Blob Index tags with parenthesis - works in Browser but not in REST API
Setting Azure Blob Index tags with parenthesis - works in Browser but not in REST API

Time:01-25

I have been trying to set some blob tags and receiving a horrible error:

Response: HTTP/1.1 400 The tags specified are invalid. It contains characters that are not permitted.

I can set the tags with the same value in container browser without any issue, but via REST api it always fails with parenthesis, I have tried encoding in several ways, but the only way to success is to omit the patenthesis (which I am currently doing).

Successful payload:

<Tags>
    <TagSet>
        <Tag>
            <Key>FileID</Key>
            <Value>307145362</Value>
        </Tag>
        <Tag>
            <Key>FileName</Key>
            <Value>/omit/gkcs2022-11-15 14.49.12.log</Value>
        </Tag>
         <Tag>
            <Key>FileType</Key>
            <Value>GKCS Log File</Value>
        </Tag>
         <Tag>
            <Key>DeviceID</Key>
            <Value>151283</Value>
        </Tag>
         <Tag>
            <Key>Timestamp</Key>
            <Value>2023-01-20T144920.192Z</Value>
        </Tag>
         <Tag>
            <Key>DOWNLOADEDTO_GBMSVINTELLIFS</Key>
            <Value>False</Value>
        </Tag>
    </TagSet>
</Tags>

Failing Payloads:

Raw:

<Tags>
    <TagSet>
        <Tag>
            <Key>FileID</Key>
            <Value>307145362</Value>
        </Tag>
        <Tag>
            <Key>FileName</Key>
            <Value>/omitted/gkcs(2022-11-15 14.49.12).log</Value>
        </Tag>
         <Tag>
            <Key>FileType</Key>
            <Value>GKCS Log File</Value>
        </Tag>
         <Tag>
            <Key>DeviceID</Key>
            <Value>151283</Value>
        </Tag>
         <Tag>
            <Key>Timestamp</Key>
            <Value>2023-01-20T144920.192Z</Value>
        </Tag>
         <Tag>
            <Key>DOWNLOADEDTO_GBMSVINTELLIFS</Key>
            <Value>False</Value>
        </Tag>
    </TagSet>
</Tags>

URL Encoding:

<Tags>
    <TagSet>
        <Tag>
            <Key>FileID</Key>
            <Value>307145362</Value>
        </Tag>
        <Tag>
            <Key>FileName</Key>
            <Value>/omit/gkcs(2022-11-15 14.49.12).log</Value>
        </Tag>
         <Tag>
            <Key>FileType</Key>
            <Value>GKCS Log File</Value>
        </Tag>
         <Tag>
            <Key>DeviceID</Key>
            <Value>151283</Value>
        </Tag>
         <Tag>
            <Key>Timestamp</Key>
            <Value>2023-01-20T144920.192Z</Value>
        </Tag>
         <Tag>
            <Key>DOWNLOADEDTO_GBMSVINTELLIFS</Key>
            <Value>False</Value>
        </Tag>
    </TagSet>
</Tags>

Escape Character:

<Tags>
    <TagSet>
        <Tag>
            <Key>FileID</Key>
            <Value>307145362</Value>
        </Tag>
        <Tag>
            <Key>FileName</Key>
            <Value>/omit/gkcs\(2022-11-15 14.49.12\(.log</Value>
        </Tag>
         <Tag>
            <Key>FileType</Key>
            <Value>GKCS Log File</Value>
        </Tag>
         <Tag>
            <Key>DeviceID</Key>
            <Value>151283</Value>
        </Tag>
         <Tag>
            <Key>Timestamp</Key>
            <Value>2023-01-20T144920.192Z</Value>
        </Tag>
         <Tag>
            <Key>DOWNLOADEDTO_GBMSVINTELLIFS</Key>
            <Value>False</Value>
        </Tag>
    </TagSet>
</Tags>

CodePudding user response:

As per Azure Storage documentation, only the following characters can be used in valid tag keys and values:

  • Lowercase and uppercase letters (a-z, A-Z)
  • Digits (0-9)
  • A space ( )
  • Plus ( ), minus (-), period (.), solidus (/), colon (:), equals (=), and underscore (_)

Unfortunately, parenthesis characters are not currently supported by the Set Blob Tags REST API request.

  • Related