You can script this easily with the Cactvs Cheminformatics Toolkit (free academic versions at www.xemistry.com/academic)
Here an example for aspirin, Tcl version:
---snip--
echo [ens get "2-acetyloxybenzoic acid" E_CID"]
---snip--
Python version:
---snip--
print(Ens("2-acetyloxybenzoic acid").E_CID)
---snip---
Please be aware that the name resolution is not 100% reliable, and that above script retrieves the structure with most references - the case with multiple CIDs cited above is not an error, but an indication of limitations in name generation, structure standardization, etc.
Check Entrez Direct: http://www.ncbi.nlm.nih.gov/books/NBK179288/ It's eutils in a more usable package.
Would help to show an example term and output. Depending on the precise search term, getting "a whole lot of uids" is a common and expected result.
In my case i need to get a cid (for eg. phenol "CID:996") and then link that id programatically to other db's.
but if I do:
I'm getting a whole lot of uid's but I only need a particular id (i.e CID:996) and not all other id's as that'll be an overhead.
So, is there any way to get id for the exact term(here:phenol) using eutils[just one id].
You can use qualifiers in the term. For example:
to search by IUPAC Name. However in this case (and many others), that will still not result in a 1:1 mapping to UIDs. Looks from your comment like you found a good solution.
Yes, even IUPAC field provides a bunch of id's.
Wonder if it can be done via eutils.