I am using the Azure Mobile Services API endpoint to return a shared subscription URL to access my azure storage container as follows:
var blobService = azure.createBlobService(accountName, key, host); blobService.createContainerIfNotExists(containerName, function(err) { if (err) { cb(err, null); return; }
Then I return this URL to my iOS client to download the file and treat it like:
client.invokeAPI("document/\(document.idValue).\(document.fileExtension)", body: nil, HTTPMethod: "PUT", parameters: nil, headers: nil) { result, response, error in if let dictResult = result as? NSDictionary { // Get the SAS URL to write directly to the blob storage if let location = dictResult["location"] as? String { let url = NSURL(string: location) let request = NSURLRequest(URL: url) let uploadTask = session.uploadTaskWithRequest(request, fromFile: localFile) { data, response, error in if completionBlock != nil { let success = (error == nil && httpResponse.statusCode == 200) completionBlock!(success) } } } } } uploadTask.resume()
IOS client receives 404 response with message
<?xml version="1.0" encoding="utf-8"?><Error><Code>ResourceNotFound</Code><Message>The specified resource does not exist.
The container exists in the storage account, and requests for blobs from the container with access keys are successful. This new blob will not exist since it is a new download, but why am I getting 404 for a request to write to the container?
source share