osf.io icon indicating copy to clipboard operation
osf.io copied to clipboard

Direct link for http request

Open mbradle opened this issue 3 years ago • 2 comments

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.

mbradle avatar Aug 01 '21 17:08 mbradle

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.

Johnetordoff avatar Aug 02 '21 12:08 Johnetordoff

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.

mbradle avatar Aug 02 '21 12:08 mbradle