function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shubham KhajjepawarShubham Khajjepawar 

How to export state and country data using api

How to export data if I select country then export under all states 
SwethaSwetha (Salesforce Developers) 
HI Shubham,
You can use REST API with describeSObject . The below articles would be helpful
https://salesforce.stackexchange.com/questions/13135/access-to-state-and-country-picklist-values-through-apex-or-api

https://stackoverflow.com/questions/20975357/retrieve-country-state-and-industry-lists-from-salesforce-using-the-metadata-api

https://salesforce.stackexchange.com/questions/223117/how-do-i-retrieve-country-and-state-picklist-values-addresssettings-via-api

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describesobject.htm?search_text=describesobject
 
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
David Zhu 🔥David Zhu 🔥
You use metadata API to retreive Country and State list. Please add the following to Package.xml file and retrieve all country and states picklist.

<types>
    <members>Address</members>
    <name>Settings</name>
</types>

The retrieved file is called Address.setting-meta.xml under Settings folder.