Azure storage Rest Api File service - rest

I am trying to upload with Http request a file (not a blob) in Azure File service.
I have successfully uploaded a blob with Http request. I am using the same Authentication method (SharedKey). Inside documentation I found that I had to first create and then write a file.
The Create File operation creates a new file or replaces a file. Note
that calling Create File only initializes the file. To add content to
a file, call the Put Range operation
Is it correct. Does anyone knows any other option. It seems a bit wrong to me. Does anyone has an example in .net?
(I even tried this workflow but i got a 400 error)

I guess you were expecting the Create File API works like Put Block Blob which uploads the content in the request body. Actually Create File is similar to Put Page/Append Blob. It requires you to initialize the resource first and then update the content. You can refer to the sample that #Michael pointed in the comment.

Related

How to set up blob storage Property before web activity drop a file into Blob storage?

I have created pipeline in Azure Data factory in which I'm Have web activity which copy the excel(xlsx) file from Dropbox App console and have another web activity which copy the file into Blob Storage, Pipeline is executing successfully, it is copying the file in same xlsx format in blob Storage as well but when I open the excel file from blob storage getting error that "The file myfilename.xlsx may not render correctly as it contains an unrecognized extension"
when the web activity copy the file I see it has content-Type = Applicatoin/octent-stream, I did try to change the content-type = application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, Any help would be appreciate to set the blob storage property before I copy my excel file from web activity output.
The web activity's associated service and dataset characteristics are to be applied. I'll give you a solution that I know will work in the interim. Use two online activities. The data is initially retrieved from the blob. The first web activity's output is used as the body of the second web activity. In the example below, I substitute another blob for the website. (It essentially duplicates the blob.)
Here, the URL looks like this to obtain the blob:
https://.blob.core.windows.net///;
As well, I employ MSI authentication. You must assign the Data Factory rights in the storage account (or container) access control for this to function.
The header x-ms-version must then be added, along with the value 2017-11-09. (A picture of an earlier solution illustrates this.)
You should use https://storage.azure.com as the resource.
If an error message appears,
AuthorizationPermissionMismatch
This operation cannot be carried out under the terms of this request.Then you might need to visit your storage account and grant additional permissions, as seen below. Wait for the permissions to spread over a few minutes; otherwise, you risk getting a false negative.

Uploading a large file to OneDrive shared folder issue (createUploadSession error)

Although Microsoft official documentation quite rich, I can't find any details of how exactly I should upload the large file to a shared folder (not to my drive).
I've followed the docs:
POST /drives/{driveId}/items/{itemId}/createUploadSession
{"Item":{"#microsoft.graph.conflictBehavior":"replace","name":"20200310-155252-700.jpg"}}
Where the itemId is the folder id I am trying to upload that file to.
However, it returns 400 Bad Request error Name from path does not match name from body message.
But the request path provided in docs doesn't expect passing the file name at all!
I kind of suspecting that the itemId should be an existing item on the drive (not even inside the folder), rather than a folder id to create that file in, but a) I am not sure about that and b) how is it possible to have an empty file without any content before having that upload complete (again, if I am right about b)).
Am I at least following a right direction? Thanks!
This is because poorly updated OneDrive Api official documentation Microsoft has.
A correct url must be as follows:
$"{baseUrl}/drives/{drive}/items/{itemId}:/{fileName}:/createUploadSession"

Access file content within an Azure Dev Ops/VSTS artifact using REST API

I am looking to get the contents of a file I pushed as an artifact to Azure DevOps
I was able to get a json response with a URL to the artifact zip by using this API
https://dev.azure.com/uifabric/cd9e4e13-b8db-429a-9c21-499bf1c98639/_apis/build/builds/8838/artifacts?artifactName=drop&api-version=5.0
However, what I really want is the contents of a file called bundlesizes.json within this zip.
I did come across the Get File API here which mentions an API as follows
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/artifacts?artifactName={artifactName}&fileId={fileId}&fileName={fileName}&api-version=5.0
I tried replacing it as follows
https://dev.azure.com/uifabric/fabricpublic/_apis/build/builds/8838/artifacts?artifactName=drop&fileId=bundlesizes.json&fileName=bundlesizes.json&api-version=5.0
However, I get this error
I think what I am missing is the fileId field, where I am not aware what needs to go in. The documentation says fileId is the The primary key for the file. However, I don't know where I can find it.
Microsoft doesn't have complete documentation on how to get FileID.
You can take a different approach and download the file using below API. You can get the ContainerID through GET build details.
https://collectionurl/tfs/defaultcollection/_apis/resources/Containers/${containerid}?itempath=drop

Syntax for tRest component to upload local file Talend

So i have to upload text file to server with PUT request, i know there is similar solution but as it seems, not only for me it is generating errors:
solution generating error message
I know there is possibility to this this with tFileFetch component but it only support POST request.
My current job looks like this:
talend Job
And my question is how to write correct syntax in HTTP body to upload local file.
I couldn't get tREST to upload a file with the PUT http method. I'm pretty sure it's not possible. You should be able to do it with a custom java code though, that you can find in this article.

With filepicker.io, is there a way to get the original file path?

I am using filepicker.io and specially computer as main service.
I would like to get the original file path of a file uploaded through the API.
For example, if I upload a file located at /my/path/in/my/computer/file.zip, I will get in the FPFile object the filepicker.io URL but not the original file path.
Is there a way to get it ?
PS: I have tried to retrieve the stat of the file too without success.
Due to browser security limitations, the real local path of the file is never exposed to the javascript application. For more information, see http://davidwalsh.name/fakepath