sasha
1
From the website, this doesn’t work:
curl -X 'GET' \
'https://api.materialsproject.org/molecules/core/?molecule_ids=mol-45827&_limit=100&deprecated=false&_per_page=100&_skip=0&_all_fields=false' \
-H 'accept: application/json' \
-H 'X-API-KEY: XXX'
Response:
{"data":[],"meta":{"api_version":"0.51.24","time_stamp":"2023-08-12T10:00:46.802062","total_doc":0,"max_limit":1000,"default_fields":["molecule_id","formula_alphabetical","last_updated"]}}
This works (same API key):
curl -X 'GET' \
'https://api.materialsproject.org/materials/core/?material_ids=mp-777129&deprecated=false&_per_page=100&_skip=0&_limit=100&_all_fields=false' \
-H 'accept: application/json' \
-H 'X-API-KEY: XXX'
@sasha, we have just updated the molecules API with new data. You should change your endpoint to /molecules/jcesr
to get the legacy data.
Instead of direct requests, you can also use the MPRester client:
from mp_api.client import MPRester
with MPRester("your_api_key") as mpr:
docs = mpr.molecules.jcesr.search()
Although, it looks like it needs an update to work with the queries on molecule_ids
.
– Jason
sasha
3
Thanks Jason, yes molecules_ids doesn’t work:
'https://api.materialsproject.org/molecules/jcesr/?molecule_ids=mol-45827&_limit=100&deprecated=false&_per_page=100&_skip=0&_all_fields=false' \
-H 'accept: application/json' \
-H 'X-API-KEY: XXX'
{"detail":"Request contains query parameters which cannot be used: molecule_ids, deprecated"}