Using advanced search syntax in URL


Dear users and developers,

I’d like to gather data of ternary alloys such as transition metal ternary alloy

From the URL like,

I already can get total magnetization of any composition of CoxOy

And in Web of Explore Materials, there are advanced Search syntax like *-Fe-O.

(We can find any material including Fe-O)

Can I use this function (*-Fe-O) in URL like

or should I use pymatgen interface?

Thanks alot


Here’s the python code to do what you ask:

from pymatgen import MPRester                                                  
if __name__ == "__main__":                                                     
    MAPI_KEY = "XXXXXX"  # You must change this to your Materials API key! (or set MAPI_KEY env variable)
    with MPRester(MAPI_KEY) as m: # object for connecting to MP Rest interface 
        criteria  ={'elements': {'$all':['Fe', 'O']}}                          
        properties=['pretty_formula', 'full_formula', 'total_magnetization']   
        data = m.query(criteria, properties)                                   

It prints 4568 elements with their corresponding total magnetization


And just to answer your initial question if you can accomplish this with an URL link and the REST library, the answer is currently no. This is from the API help page

Advanced query using Mongo-like language for flexible queries on the Materials Project database. This provides the possibility of queries which would otherwise not be possible using the other simpler REST forms.