I have explained about x-ms-version in my previous post where I gave an example of Service Management APIs. Just to refresh, x-ms-version is a HTTP header which is used in Service Management API/ Azure Storage Services API calls to specify the version of operation. In other words users can specify which version of an operation they want to use by setting the x-ms-version request header. The benefit of x-ms-version is that if there is a new version of the API available, it will not break the functionality of your existing code. Users can modify the code to call a newer version of API by specifying the x-ms-version HTTP Headers.
In this blog post, I will demonstrate the use and impact of x-ms-version WITH Azure Storage Services API calls.
Default x-ms-version for Storage Service
In this example, I will simply use IE and browse the following URL:
In this URL, testxmsversion is my container and comp=list is the command to list the blob in this container. Since I made this container public to simplify this scenario, thus I was able to access it right away from my Internet Explorer. Here is the response in IE where I could see that I got just one file HDD.jpg in this container.
Now let’s look at the request header. I am using Fiddler to inspect the request and response.
Accept: text/html,application/xhtml+xml, */*
User-Agent: Mozilla/5.0 (compatible;MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Accept-Encoding: gzip, deflate, peerdist
Here is the response:
HTTP/1.1 200 OK
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
Date: Sun, 29 Sep 2013 04:50:06 GMT
If you closely look at the request headers, you would see that there is no mention of x-ms-version. But we could see x-ms-version is response. IE doesn’t know about x-ms-version thus it was not included. Since this header was missing, “2009-09-19” was considered the default version. You could set your own default x-ms-version. I will explain how to do this in my next blob post. Here is a link which shows currently available versions of storage services: http://msdn.microsoft.com/en-us/library/windowsazure/dd894041.aspx.
Let’s try to pass x-ms-version and inspects things:
For this example, I am going to use Fiddler to make a call. I will use the same request as shown in my previous example with an exception. Now I will pass x-ms-version as well. Here is the request headers:
This are the response headers I got after making the call:
HTTP/1.1 200 OK
Server: Blob Service Version 1.0 Microsoft-HTTPAPI/2.0
Date: Sun, 29 Sep 2013 06:09:17 GMT
Here is response:
Points to note
So if you compare both the outputs, you will notice that query with x-ms-version: 2009-07-17 did not return any properties field.
If you also noticed the response headers Server, it was changed to Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 from Blob Service Version 1.0 Microsoft-HTTPAPI/2.0.