I’m running into this issue presently, trying to form a POST to infura.io to add a file to IPFS using a language called Hoon which is used in a project called Urbit.
I’ve gotten pretty close, but no matter what I do, I can’t seem to get Abspath: /a/path.png to be recognized by the endpoint to allow the upload. Further, when I try to copy headers created by logging the raw output of curl and postman, I don’t even see the Abspath at all in what it produces.
EDIT: note that sometimes I posted to localhost:1090 where I had netcat listening to write to file to get my output so assume that I’m actually pointing at the right endpoint.
EDIT 2: I don’t even have a real filepath as I’m actually grabbing the raw data of a png from another web-generator of pngs to post to IPFS. The eventual goal would be generative creation of content to be posted to IPFS .
I mean, yes all of this is confusing, but I would blame the multipart/form-data specs for being confusing.
(we could maybe make the docs and error message better ?)
I’m running into this issue presently, trying to form a POST to infura.io to add a file to IPFS using a language called Hoon which is used in a project called Urbit.
I’ve just learnt about that language from you and have no idea how to use it, but you need to create a multipart/form-data with a path param in the form-data.
It seems in most like people try passing the path as a GET parameters while I belive it should be in form-data.
My question is what does the raw HTTP need to look like.
If I understand your answer correctly, I need to pass path, and I think that’s right, but somehow I’m doing it wrong and I can’t quite figure out how.
In this discussion I linked to, they show that parameter as Abspath:, which I have tried a few ways but not had success. Also I can’t see it in what I’ve recorded from Postman and curl when logging the results of what would have otherwise been a successful call to infura and neither of those actually show that ‘header’ where I think it would go, yet, as I say, they are otherwise successful.
Is Abspath wrong? Is it checked somehow for validity? What encoding does it expect?
edit:
It seems in most like people try passing the path as a GET parameters while I belive it should be in form-data .
This is I think where I’m having the issue - I’m trying to code it in there but I lack sufficient information about what that looks like at raw http level.
By default if you add /tmp/example to IPFS, the blocks making /tmp/example are copied into ~/.ipfs/blocks/..., to do that the CLI reads /tmp/example and stream the bytes over the HTTP connection.
If you use the filestore, IPFS’s datastore store the path as well as offset and length kinda like this /tmp/example:123:20 (IPFS blocks are far bigger than 20 bytes, just this is an example).
Then if someone wants to download this file from you, your deamon open /tmp/example and read it from there, that avoid having too copy of /tmp/example stored on your machine.
This is useless if you doesn’t use filestore.
An example
Here some random golang code dealing with the form-data of IPFS add:
I get the same response back if I exclude Abspath. Also - like I said, I don’t see that in a simple curl or postman call that actually does work so idgi why my version isn’t working. I know this is hard without knowing the specifics of my language, too - thank you for helping me consider my issue.