My next step is to upload a picture file to that container. Now, you won't need to change much of the code, but as we are now starting to expand the number of actions we are performing, it starts to make sense to refactor the single implementation to cover multiple implementations.
Now the main crux of the BlobRequest class, that does the heavy lifting, is:
- Setup the URI for the REST actions. This needs to also consider any query parameters such as acl for setting permissions on the container to either public or private or when providing metadata
- Adding the Date header (x-ms-date)
- Adding (and creating) the Authorization header
- Adding the body for operations such as PUT blob
Now, some things to remember, you could almost call them gotchas:
- Storage REST operations are singular, so creating a public container for example is actually two steps:
- When writing to the HttpWebRequest body (through the GetRequestStream() method), do this after you create and add the Authorization header (which should also be the last step in creating the REST request) otherwise you will get funky errors like "Resource not found"
My next task is to continue building out the BlobRequest functionality and implement a WebRole for uploading and displaying my photos. 🙂