CenterForOpenScience / osf.io

Facilitating Open Science
https://osf.io
Apache License 2.0
670 stars 329 forks source link

Direct link for http request #9736

Open mbradle opened 3 years ago

mbradle commented 3 years ago

Thanks for OSF! I'm wondering if is is possible to access files directly via a url giving a request. What I would like to be able to do is run something like

xmllint https://osf.io/e6vja/

on an xml file stored on OSF and have it parse and output the file. Is that possible? Naively, I'm thinking something like

xmllint https://osf.io/e6vja/get

in analogy to https://osf.io/e6vja/download. Perhaps that's already possible and I haven't figured out how to do it, in which case I'd be glad for some pointers. Or perhaps that's not in the spirit of OSF, which I'm guessing wants to be file-type agnostic, which is ok--I can still download, etc.; nevertheless, the capability would be of use to me. In any case, thanks, and best wishes.

Johnetordoff commented 3 years ago

So if I wanted to parse an XML file stored on our site I'd probably write a python script to do that. Here's some examples of how to make a request for parsable XML.

Also I'm not entirely sure about your URL formatting suggestion, but it you might want to look at our developer docs they outline a lot of URL behavior.

mbradle commented 3 years ago

Thanks for your reply. I had indeed written such a python script retrieve_xml_via_get.py such that I could do

python retrieve_xml_via_get.py https://osf.io/e6vja/download out.xml

xmllint out.xml

That's a perfectly satisfactory solution. I was just hoping to do it in one line (xmllint is a stand in for several other xml command line codes I use)

xmllint https://osf.io/e6vja/...

I'll poke around the documentation some more. Thanks again, and best wishes.