Closed nclopezo closed 8 years ago
Anyway, I can make the new web interface to convert all ChEMBL IDs to capital letters.
Yes, this is by design. We tried to design the API to be as permissive as possible whenever it makes sense. If someone requests the compound by ID the 'CHEMBL' part is not case sensitive because it's easy to convert it to upper case and there is no ambiguity here.
But when you are using filters (for example ?foo=bar
) this means: find a resource with an attribute foo
exactly equal to bar
. It can also be written like this: ?foo__exact=bar
. But there is a type of filter that is case insensitive, just use iexact
so in your case:
https://www.ebi.ac.uk/chembl/api/data/mechanism.json?molecule_chembl_id__iexact=chembl17
I noted that if you want the information for a molecule, it doesn't matter if you write 'chembl' or 'CHEMBL' in the url. See for example that both: https://www.ebi.ac.uk/chembl/api/data/molecule/chembl17.json and: https://www.ebi.ac.uk/chembl/api/data/molecule/CHEMBL17.json Return a valid response.
But If I try the same for a mechanism of action, the response is not the same:
https://www.ebi.ac.uk/chembl/api/data/mechanism.json?molecule_chembl_id=CHEMBL17 https://www.ebi.ac.uk/chembl/api/data/mechanism.json?molecule_chembl_id=chembl17
The old interface accepts both capital and not capital letters in the url, but this can cause confusion for a user in the new web interface because the information displayed on the page will be different depending if the url has capital letters or not.