Page 1 of 1

How to download image files

Posted: Sat Dec 07, 2013 4:22 am
by nikhil
I am having difficulty downloading the image files when using authentication. For example, the image available at https://ops.epo.org/3.1/rest-services/p ... ng?Range=1 can be downloaded anonymously but not with authorization.

Is there some example command or code that I can use to download the images?

Re: How to download image files

Posted: Mon Dec 09, 2013 9:43 am
by EPO / OPS Support
Dear user,

You request should work in both environments. You don't need to use ?Range for clipped images because there is always only one representative image and that one is always on the first page anyway. But that can not cause your problems, it's just a remark.

We can not reconstruct your problem so please be so kind and repeat your search with the token and post for us your system's request and even more importantly, system response.

Kind regards,

OPS support

Re: How to download image files

Posted: Mon Dec 09, 2013 12:32 pm
by nikhil
Hello,

Thanks for the reply. I was trying the following curl command and it was not getting any data:
curl -H "Authorization: Bearer vh0TxLuixpzyFV3CVXWcBzxqzZIK" "https://ops.epo.org/3.1/rest-services/p ... stpage.png" -o image.jpg

I tried the following wget command and it worked fine:
wget --header='Authorization: Bearer vh0TxLuixpzyFV3CVXWcBzxqzZIK' "https://ops.epo.org/3.1/rest-services/p ... stpage.png" -O image.jpg

I think that there is some error in the curl command that I am trying. I have switched to using wget, and it works fine. For reference, it will be great if you could post the correct curl command.

This was just for testing and we will be implementing this is Java and/or PHP. I will get back to you if we face any further issues there.

Also, I have a suggestion / request - please release libraries for Java, .NET, PHP etc. which can be used to download data from OPS. The library can take care of all the rate limiting, fair use, access tokens etc. and expose a simple API to the user.

Regards,
Nikhil

Re: How to download image files

Posted: Mon Dec 09, 2013 4:27 pm
by EPO / OPS Support
Dear user,

Your can test your your commands onhttps://developers.epo.org/

You reply seems different than your original question, since you are now talking about two different documents, one working and one not working and in your original email you said that one and the same number is working as anonymous only - so which is it?

Kind regards,

OPS support

Re: How to download image files

Posted: Tue Dec 10, 2013 3:35 am
by nikhil
Sorry, my mistake, I mixed up a couple of different URLs. The initial problem that I needed help with has been resolved now.

BTW, I tried to remove the Range=1 as suggested by you but that seems to create a problem. In the browser, if I try https://ops.epo.org/3.1/rest-services/p ... stpage.png then I get

<fault><code>SERVER.EntityNotFound</code><message>No results found</message></fault>

However, https://ops.epo.org/3.1/rest-services/p ... ng?Range=1 works fine.

Re: How to download image files

Posted: Tue Dec 10, 2013 6:15 am
by nikhil
Update: We have been testing this some more and the behavior without Range=1 is inconsistent - it sometimes works and sometimes doesn't. Maybe the service is running on multiple servers and some of them expect Range=1 ?

Re: How to download image files

Posted: Tue Dec 10, 2013 9:02 am
by EPO / OPS Support
Dear user,

As far as is known to us you never need ranges with first page clippings, but you do need them with normal drawings. If you feel like you have better result using Range then you can use it. I don't think that inconsistency is due to what you said - send me few examples of those that don't work without Range so that I can have a look.

Kind regards,

OPS support