I am trying to insert object into LakeFS repo with...
# help
o
I am trying to insert object into LakeFS repo with java client. I am trying to insert object using postman!! I am facing one issue !! I am not able to understand what I need to insert into path and into physical address while sending in body. Any help would be appreciated Getting this response after hitting this API { "message": "parameter \"path\" in query has an error: value is required but missing: value is required but missing" }
j
Hi @Omkar Patil This is the signature of the
uploadObjectCall
method of the
ObjectsApi
java class:
uploadObjectCall(String repository, String branch, String path, String storageClass, String ifNoneMatch, File content, final ApiCallback _callback)
The repository and branch parts are quite easy to understand.
path
is the namespace under your branch, meaning the if you have a repository called
myrepo
and a branch called
mybranch
then for
<lakefs://myrepo/mybranch/some/name/space>
the path is:
some/name/space
can you share the Java code you’re trying to execute?
o
I am trying through postman
j
Using Postman will be much more complicated than using the Java client. You need to add the authentication headers and their values (after you generated them) and also use the user credentials. It would be easier to use the Java client that does that for you. Also, the image you sent is using the response format of that API call as the request…
o
Yes I have added authentication headers
y
@Omkar Patil, also note that the path parameter when uploading an object is to be given using a query parameter. The content of the request should be used for the file's actual content. See the API reference for how to upload an object.
o
@Yoni Augarten I am following the same document but I am not able to figure exact value for path in body
y
The path is where you want to upload the object to, in your repository.
You can start by uploading a file from the UI, and inspecting the upload request in the network console. This will give you an idea of what happens under the hood.
o
@Yoni Augarten I am checking in network tab!! I copied into postman the same payload but it is not working.. facing the same error
If possible can we connect on huddle?
y
Thanks for the information. In order for the community to benefit from our conversation in the future, let's keep this in the chat.
Can you confirm that uploading a file has worked from the UI?
o
This is the UI image and payload
y
@Omkar Patil I'm taking a look. One second please
o
@Omkar Patil from the looks of it , it seems like you're trying to pass the response parameters as the request.
👍🏻 1
the POST body shouldn't be JSON, it should be
multipart/form-data
with a
content
field. See https://docs.lakefs.io/reference/api.html#/objects/uploadObject
o
Thank you your help @Oz Katz!! I tried with adding header as Content-Type and value as Multipart/form-data but I am facing the error "message": "no multipart boundary param in Content-Type"
Could you please give one example how we can pass request body?
y
@Omkar Patil, as @Jonathan Rosenberg mentioned before - uploading an object via Postman requires some knowledge, in particular sending multipart requests. As suggested, using one of our clients (Java, Python, or the AWS CLI) can simplify things. If you are sure you want to use Postman, you can use this guide to see how you can copy a request from the web console to Postman.
Update: I see this guide doesn't really work with multipart requests.