I am using an API to retrieve data, but I encountered an error

Hello, I am using an API to retrieve data, but I encountered an error. Can you please tell me what the issue is?
/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/matproj.py:8: builtins.UserWarning: The MPRester class has been moved. You can now use from mp_api import MPRester.
Traceback (most recent call last):
File “/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/core/client.py”, line 371, in get_data_by_id
criteria=criteria, fields=fields, suburl=document_id, # type: ignore
File “/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/core/client.py”, line 336, in _query_resource_data
use_document_model=use_document_model,
File “/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/core/client.py”, line 304, in _query_resource
f"REST query returned with error status code {response.status_code} "
mp_api.core.client.MPRestError: REST query returned with error status code 404 on URL https://api.materialsproject.org/materials/mp-23896/?limit=1&fields=structure with message:
Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/data/xdh/from mp_api.py”, line 7, in
structure = mpr.get_structure_by_material_id(“mp-23896”)
File “/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/client.py”, line 205, in get_structure_by_material_id
material_id=material_id, final=final
File “/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/routes/materials/client.py”, line 37, in get_structure_by_material_id
response = self.get_data_by_id(material_id, fields=[“structure”])
File “/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/core/client.py”, line 381, in get_data_by_id
new_document_id = mpr.get_materials_id_from_task_id(document_id)
File “/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/client.py”, line 253, in get_materials_id_from_task_id
docs = self.materials.search(task_ids=[task_id], fields=[“material_id”])
File “/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/core/client.py”, line 438, in search
num_chunks=num_chunks,
File “/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/core/client.py”, line 461, in _get_all_documents
results = self._query_resource(query_params, fields=fields,)
File “/home/lab106-dell/.conda/envs/gnn/lib/python3.7/site-packages/mp_api/core/client.py”, line 304, in _query_resource
f"REST query returned with error status code {response.status_code} "
mp_api.core.client.MPRestError: REST query returned with error status code 404 on URL https://api.materialsproject.org/materials/?task_ids=mp-23896&limit=1000&fields=material_id with message:
Not Found

Make sure to run the latest versions of pymatgen and mp-api.

I checked my versions, and both packages are up-to-date. I don’t know the reason for the issue.Do you have any solutions?

The fact that the request goes to https://api.materialsproject.org/materials/ instead of https://api.materialsproject.org/materials/summary or https://api.materialsproject.org/materials/core tells me that your mp-api client is out of date. It should be 0.39.4 currently.

I understand. I will try it out.Thank you very much. I’ll come back to you if I have any questions.