Disclaimer: These APIs are provided for educational purposes only.
1. Get Country List API
This API returns a list of all countries with their names and codes.
Endpoint
GET https://apitpoint.com/api/countriesAPI.php
Response
[
{
"country_name": "United States",
"country_code": "US"
},
{
"country_name": "Canada",
"country_code": "CA"
}
// More countries
]
Sample Request
fetch('http://localhost:81/apitpoint/api/countriesAPI.php')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Try It Out
2. Search Countries API
This API allows you to search for countries by name or code. Provide a search term to filter the results.
Endpoint
GET http://localhost:81/apitpoint/api/searchCountries.php?search=India
Response
[
{
"country_name": "India",
"country_code": "IN"
}
// If no matches, might return a message
]
Sample Request
fetch('https://apitpoint.com/api/searchCountries.php?search=India')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Try It Out