1

I’m using Windows 10 and curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL.

I’m trying to download files from the ESA API using this curl command:

curl --ssl-no-revoke -u eduardojsilvajr \
    https://scihub.copernicus.eu/dhus/search?q=footprint:"Intersects(POLYGON((-4.53 29.85,26.75 29.85,26.75 46.80,-4.53 46.80,-4.53 29.85)))"

This is an example from the Copernicus Open Access Hub API site.

But when I run the above curl command, I get this message:

<?xml version="1.0" encoding="utf-8"?><feed xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom">
<title>Sentinels Scientific Data Hub search results for: footprint:Intersects(POLYGON((-4.53</title>
<subtitle>Displaying  results. Request done in 0.001 seconds.</subtitle>
<updated>2019-02-20T23:17:34.037Z</updated>
<author>
<name>Sentinels Scientific Data Hub</name>
</author>
<id>https://scihub.copernicus.eu/dhus/search?q=footprint:Intersects(POLYGON((-4.53</id>
<opensearch:totalResults/>
<opensearch:startIndex>0</opensearch:startIndex>
<opensearch:itemsPerPage>10</opensearch:itemsPerPage>
<opensearch:Query role="request" searchTerms="footprint:Intersects(POLYGON((-4.53" startPage="1"/>
<link rel="self" type="application/atom+xml" href="https://scihub.copernicus.eu/dhus/search?q=footprint:Intersects(POLYGON((-4.53&amp;start=0&amp;rows=10"/>
<link rel="first" type="application/atom+xml" href="https://scihub.copernicus.eu/dhus/search?q=footprint:Intersects(POLYGON((-4.53&amp;start=0&amp;rows=10"/>

As you can see there is a problem with spaces. I tried backslash, single quotes, double quotes, and passing the URL using a file (@file), but nothing makes this curl command work.

How do I make it work?

8
  • Try wrapping the whole URL in quotes like this: "https://scihub.copernicus.eu/dhus/search?q=footprint:Intersects(POLYGON((-4.53 29.85,26.75 29.85,26.75 46.80,-4.53 46.80,-4.53 29.85)))" Feb 21, 2019 at 0:04
  • @JakeGould you haven't only wrapped his URL in quotes, you (rightly or wrongly), removed the quote he put before Intsersects and pretty much any other quotes he had within the URL (which may be correct - lets see, but you what you said you didn't adequately express what you actually did)
    – barlop
    Feb 21, 2019 at 0:28
  • (1) Try using quotes and backslashes: "Intersects(POLYGON((-4.53\ 29.85,26.75\ 29.85,….  Try this with " and again with '. (2) The ugly answer: try replacing the spaces with %20; e.g., "Intersects(POLYGON((-4.53%2029.85,26.75%2029.85.….  Try this with and without quotes (but it’s probably best to use quotes).
    – Scott
    Feb 21, 2019 at 0:33
  • @JakeGould i've already did this... didn't work Feb 21, 2019 at 3:26
  • @Scott after using \ before all spaces i can see using the -v parameters that de url was passed correctly but i'm still geting a "400 bad request" from the server. but i could manage to make thinks working using wget and ubuntu 16. thanks for the help Feb 21, 2019 at 3:34

1 Answer 1

1

You can use curl's built-in --data-urlencode switch like this:

curl --ssl-no-revoke -u eduardojsilvajr --data-urlencode "q=footprint:\"Intersects(POLYGON((-4.53 29.85,26.75 29.85,26.75 46.80,-4.53 46.80,-4.53 29.85)))\"" https://scihub.copernicus.eu/dhus/search

See the man page for more info.

1
  • Ha!  This question is four months old.  We have questions here that are over a decade old!
    – Scott
    Jun 25, 2019 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.