Search by formula and spacegroup

Hello all, I am new to the mp api.
How can I query data by the formula and spacegroup of a material ?
For example, how to to get all the avaiable calculated bandgaps of MoS2 with the P63mmc spacegroup in the MP database.
Thank you very much

Please consult our documentation and the accompanying examples.

Thank you very much for your reply!
I have tried it out and it works.
In the old api, there is a initial_structure option to query the unrelaxed structure,
I don’t see this option in the new api, could please instruct me how to query the
unrelaxed structure with the new api?

@Adams_ke, you should be able to query for all initial structures associated with a material by passing initial_structures as a field to a query with Alternatively, if you have the task ID for the optimization calculation, you can obtain orig_input or input data from which will contain the starting structure.

– Jason