Azure File Service REST API(rename)

Chih-Hao Huang 1 Reputation point
2022-04-04T15:49:22.917+00:00

Hi,
Followed this document https://learn.microsoft.com/en-us/rest/api/storageservices/rename-file to send rename request.
But it didn't work.
Also in the document, the header x-ms-file-rename-source:name seems a typo.
Send request with this header will get 403.

Send request with header x-ms-file-rename-source-name will pass authorization but will get
InternalError (500): Server encountered an internal error. Please try again after some time.

I am using SharedKey authentication. Other requests like get file or set metadata works fine.
I suppose there is something wrong with the API endpoint.

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,228 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Konshin, Alex 6 Reputation points
    2022-04-27T00:02:47.847+00:00

    I have finally solved the problem by looking at sources of Azure API Java SDK
    https://github.com/Azure/azure-sdk-for-java/blob/a6afd5ca8c476ae32ba7f3e5f19d288c4eb4f6bf/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java#L1338

    It is just purely documented x-ms-file-rename-source. In the sources we can see that the value should be "the URI-style path of the source file, up to 2 KB in length."
    In caseof SAS authentication the URI should include SAS token as well.

    This must be written in the documentation for Rename File request in REST API documentation! The current page contains very confusing explanation and has no any examples.
    https://learn.microsoft.com/en-us/rest/api/storageservices/rename-file

    1 person found this answer helpful.