Hello,
My requirement for the API is as follows: In the dropdown, we need to display the country names in the format below, followed by the country flag. Additionally, the corresponding country code should be saved.
Any suggestions or assistance would be greatly appreciated.
Thanks and regards,
Shashi Mishra
Hi shashi, have you tried this Forge component? International Phone Input for ODC
Thank you Faais for quick reply.
Ok,sure.
Hello @Shashi Mishra
Try this restcountries
https://restcountries.com/v3.1/all
Example Response :-
[
{
"name": { "common": "Afghanistan", "official": "Islamic Republic of Afghanistan" },
"cca2": "AF",
"cca3": "AFG",
"flags": { "png": "https://flagcdn.com/w320/af.png", "svg": "https://flagcdn.com/af.svg" },
"idd": { "root": "+9", "suffixes": ["3"] }
},
...
]
Thank you @Gourav Shrivastava ,
@Gourav Shrivastava Thanks for sharing this API.
@Shashi Mishra : Instead of https://restcountries.com/v3.1/all you can set specific fields you require. The details you can find at https://gitlab.com/restcountries/restcountries/-/blob/master/FIELDS.md
Rest API is good but Instead of using rest api you can create your own database table using following csv files. It will give you more control to handle the data and faster response.
https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes/blob/master/all/all.csv
https://github.com/datasets/country-codes/blob/main/data/country-codes.csv
Thank you @Navneet Garg