NCBI / Entrez eSearch via HTTP POST
2
0
Entering edit mode
8.9 years ago

ESearch is the Entrez method for searching the NCBI databases including NucCore / GenBank.

In the documentation for Entrez/ESearch it mentions:

Entrez text query. All special characters must be URL encoded. Spaces may be replaced by '+' signs. For very long queries (more than several hundred characters long), consider using an HTTP POST call.

I would like to use this HTTP POST rather than an HTTP GET with all the terms in the URL. However, I can't find any documentation indicating how the payload of such an HTTP POST request would be structured.

Can anyone show me where this is documented or how it is done?

cheers,
josh

ncbi esearch entrez • 4.4k views
ADD COMMENT
2
Entering edit mode
8.9 years ago

Am I missing something? For a POST method, you would only provide the query string in the POST body.

$ curl "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi" -d 'db=nuccore&term=Hepatitis%20C[Organism]+AND+7000:10000[SLEN]' |\
  xmllint --format -
ADD COMMENT
0
Entering edit mode

Yes, that also works.

I guess that answers the question.

I also found you can do this:

curl "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=nuccore" -d 'term="Hepatitis C"[Organism] AND 7000:10000[SLEN]'

which is good because this allows me to pass through the term without translating the URL special characters.

josh

ADD REPLY
0
Entering edit mode
8.9 years ago

I think the parameters would be the same as for the GET method, but using a POST instead. For example the following code will produce a link:

<form name='epostform' target='_blank' method='post' action='http://eutils.ncbi.nlm.nih.gov/entrez/eutils/epost.fcgi'>
<input type='hidden' name='db' value='pubmed'/>
<input type='hidden' name='id' value='11237011,12466850'/>
</form>

Link to <a href=\"javascript: document.forms['epostform'].submit();\">Query Results</a>
ADD COMMENT
0
Entering edit mode

Yes, that does work. I'm using entrez as a programmatic API, rather than from a web UI.

Currently I'm encoding the search terms in the URL, like this:

http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=nuccore&term=Hepatitis%20C[Organism]+AND+7000:10000[SLEN]

What I was hoping was that in the case of an HTTP POST, I could put the search terms in the payload of the request, in a nicer format, and perhaps inside an XML document, like this:

<term>
    "Hepatitis C"[Organism] AND 7000:10000[SLEN]
</term>

josh

ADD REPLY

Login before adding your answer.

Traffic: 1575 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6