i am tring to call the method /odata/Buckets({key})/UiPath.Server.Configuration.OData.GetWriteUri but I encontered some problem with the “path” parameter:
I cannot understand hot to fill this parameter. Do you have some examples or references?
as a “Blob” do i need to provide the fullpath (for example c:/temp/test.txt) in binary format?
To upload a file to a Storage Bucket using the Rest API in UiPath, you can use the “HTTP Request” activity to send a PUT request to the bucket’s endpoint. In the request, you can include the file as the body of the request and set the appropriate headers, such as the “Content-Type” and “Content-Length” headers.
Here is an example of how you can do this in UiPath:
Drag and drop the “HTTP Request” activity into your project.
In the “Method” field, select “PUT”.
In the “Uri” field, enter the URL of the Storage Bucket endpoint, including the name of the bucket and the file you want to upload. For example: https://endpoint_url/
In the “Headers” field, add the “Content-Type” and “Content-Length” headers and set their values to the appropriate values for the file you are uploading.
In the “Body” field, select “File” and then browse for the file you want to upload.
Click “OK” to save the activity and run your project.
This should upload the file to the Storage Bucket using the Rest API. Keep in mind that you may need to authenticate your request using a service account or other authentication method, depending on the security settings of your Storage Bucket.
first of all , how can I get the storage bucket endpoint?
As I understand from here(Orchestrator API - Buckets - #8 by codemonkee) I need the make 2 rest request, the first of all a “GET” requestr where I get the uri as a Response and then the PUT request.
I am still blocked on the GET request and my question is what do I need to insert in the “path” parameter and in which format.
I have tried to prototype my requests in Swagger and also thanks to the article posted by @marian.platonov (thank you!) I have build sucessfully the get request for the writeUri.
Now I am struggling with the PUT request:-).
the put request should contain
the Uri from the writeUri get request
the file in binary format as body
in the header: the keys and values contained in the previous get request (something like “x-ms-blob-type”:“BlockBlob”)
-the authentication
do I miss something?
when I tring to send the PUT request I receiv alwas the following error:
HTTP Error 411. The request must be chunked or have a content length.<
I already tried to add the content-lenght in the header but without success.
It would be helpful for others, if you include details on exactly how you are making the calls. Are you just testing with Swagger? Using Postman? Some Programming/Scripting language: PowerShell, C++, Python, Javascript, etc.?
If you can provide what you are doing, it’s easier to identify the culprit.
Steps / Actions / Code
Request Body/Headers (Sensitive information masked)
Response Body/Headers (Sensitive information masked)
Content-Length Header is the size of the request body in bytes - Are you calculating this manually, or is what you are using this providing it for you?
esponse-Code: 411
Encoding: US-ASCII
Content-Type: text/html; charset=us-ascii
Headers: {connection=[close], Content-Length=[344], content-type=[text/html; charset=us-ascii], Date=[Fri, 16 Dec 2022 08:08:03 GMT], Server=[Microsoft-HTTPAPI/2.0]}
Payload: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>
the content-Lenght is automatically calculated by the etl process. Before the request the job calculates which is the size in bytes for a specific file.