adsabs / adsabs-dev-api

Developer API service description and example client code
163 stars 58 forks source link

Impossible to get articles by entdate #55

Closed akhmerov closed 4 years ago

akhmerov commented 4 years ago

I am trying to replicate the following query via the API:

entdate:[2020-01-15 TO 2020-01-16]

In the web UI it correctly returns entries from that date range, however when I run a corresponding API query:

curl -H 'Authorization: Bearer <token>' 'https://api.adsabs.harvard.edu/v1/search/query?entdate=%5B2020-01-10%20TO%202020-01-16%5D'|jq

I get an error stating that the query was empty.

{
  "responseHeader": {
    "status": 400,
    "QTime": 0,
    "params": {
      "rows": "10",
      "start": "0",
      "wt": "json",
      "entdate": "[2020-01-10 TO 2020-01-16]",
      "fl": "id"
    }
  },
  "error": {
    "msg": "org.apache.solr.common.SolrException: The query is empty",
    "code": 400,
    "metadata": [
      "error-class",
      "org.apache.solr.common.SolrException",
      "root-error-class",
      "org.apache.solr.common.SolrException"
    ]
  }
}

Is this behavior intended? If yes, is there a way to achieve the desired result?

akhmerov commented 4 years ago

My bad, I should have been reading the syntax more attentively. The correct syntax is curl -H 'Authorization: Bearer <token>' 'https://api.adsabs.harvard.edu/v1/search/query?q=entdate%3a%5B2020-01-10%20TO%202020-01-16%5D'|jq