Remember kids, it's in the headers

cshark(30)
Published in
#ipfs
Words
325
Reading
2 min
Listen
Play
9y

Good morning, my beautiful steeps, I've been racking my brain all night to figure this out, and I hope this might be useful to someone. I set up my ipfs node server thingy. Made it writeable, got my CORS in order (because that's important) and started submitting files to it. 

Easy right? Well, it's confusing. Because when you go about submitting files to an IPFS api through a browser, all you get back is a blank page. And, seeing how you have experience with blank looking pages, you would think that your IPFS add function in the api is broken, horked, non-functional. But you, my friend, would be wrong!

Yes, you see, as it turns out, IPFS returns hashes through the api, not like you would expect, in the body of the response... but in the headers. Seriously. 

There's an http header called  "Ipfs-Hash," and that's where you'll find the glorious little hash for the file you just uploaded. Shit, fuck, crap that was difficult to figure out. But now I feel vindicated, so it's all good.

If that's the way they want to do it, I'm not bothered by that at all. But it really is the early days of this thing, and it's would have been nice to have some documentation on it. Don't worry, bruises from banging my head against the wall  for six hours will heal. And, at least we figured it out.

Thankfully, Steemit is a remarkably good resource for finding answers on this particular topic. And I highly recommend checking out a community member named Anomaly who wrote a great article that covers this.

Thanks dude. You're the best.

Now it's just a matter of writing out a competent curl library in php to interact with the thing, pull down headers, and talk to my happy sassy little cms, because there aren't any that do the job, by the way.

At least... not yet.

I'll keep you guys posted.

Remember kids, it's in the headers | Ecency