Hi Govarthini,
You can refer to this question, for the implementation of interdependent dropdowns,
https://forum.mendix.com/link/questions/119063
here I have explained the whole use case, and for the Rest call, just pass the country as a query when fetching the states by get call and do the same for states, in the on change microflow,
Let me know If you face any issue.
Hope it helps!