ItsPerfect Get Countries
Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)
Version | Date | Created / Updated | Notes |
---|---|---|---|
v1.0 | N/A | Hristiyan | First publish |
WIth each create orders call we need to be sending a countryId
code for the respective delivery county on the order.
In order to do this, we are able to obtain a list with all of the available countries and their respective IDs in ItsPerfect. We don’t need this list to be visible anywhere, we can store it in a file (similar like we do for the taxonomy).
We don’t expect changes in the IDs of the countries in ItsPerfect, but just to be on the safe side we want to delete the data in the file (or delete the file, whatever is easier from Dev side) each time the GET countries script is run and then freshly store the data from the response.
API Docs : https://www.itsperfect-solutions.com/api-v2/countries
API Call : GET /api/v2/countries
Example response :
{
"countries": [
{
"id": 1,
"default": 1,
"country": "Netherlands",
"iso2": "NL",
"iso3": "NLD",
"postingGroup": 5,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 2,
"default": 0,
"country": "Belgium",
"iso2": "BE",
"iso3": "BEL",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 3,
"default": 0,
"country": "Germany",
"iso2": "DE",
"iso3": "DEU",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 4,
"default": 0,
"country": "France",
"iso2": "FR",
"iso3": "FRA",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 5,
"default": 0,
"country": "Spain",
"iso2": "ES",
"iso3": "ESP",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 6,
"default": 0,
"country": "Italy",
"iso2": "IT",
"iso3": "ITA",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 9,
"default": 0,
"country": "Turkey",
"iso2": "TR",
"iso3": "TUR",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 7,
"default": 0,
"country": "Israel",
"iso2": "IL",
"iso3": "ISR",
"postingGroup": 7,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 8,
"default": 0,
"country": "Canada",
"iso2": "CA",
"iso3": "CAN",
"postingGroup": 7,
"currency": {
"id": 3,
"iso": "CAD",
"currency": "Canadian Dollar"
}
},
{
"id": 10,
"default": 0,
"country": "United States of America",
"iso2": "US",
"iso3": "USA",
"postingGroup": 7,
"currency": {
"id": 2,
"iso": "USD",
"currency": "US Dollar"
}
},
{
"id": 11,
"default": 0,
"country": "India",
"iso2": "IN",
"iso3": "IND",
"postingGroup": 7,
"currency": {
"id": 2,
"iso": "USD",
"currency": "US Dollar"
}
},
{
"id": 12,
"default": 0,
"country": "China",
"iso2": "CN",
"iso3": "CHN",
"postingGroup": 7,
"currency": {
"id": 2,
"iso": "USD",
"currency": "US Dollar"
}
},
{
"id": 13,
"default": 0,
"country": "Pakistan",
"iso2": "PK",
"iso3": "PAK",
"postingGroup": 7,
"currency": {
"id": 2,
"iso": "USD",
"currency": "US Dollar"
}
},
{
"id": 14,
"default": 0,
"country": "Vietnam",
"iso2": "VN",
"iso3": "VNM",
"postingGroup": 7,
"currency": {
"id": 2,
"iso": "USD",
"currency": "US Dollar"
}
},
{
"id": 21,
"default": 0,
"country": "Serbia",
"iso2": "RS",
"iso3": "SRB",
"postingGroup": 7,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 15,
"default": 0,
"country": "Mexico",
"iso2": "MX",
"iso3": "MEX",
"postingGroup": 7,
"currency": {
"id": 2,
"iso": "USD",
"currency": "US Dollar"
}
},
{
"id": 23,
"default": 0,
"country": "Hong Kong",
"iso2": "HK",
"iso3": "HKG",
"postingGroup": 7,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 27,
"default": 0,
"country": "Thailand",
"iso2": "TH",
"iso3": "THA",
"postingGroup": 7,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 16,
"default": 0,
"country": "Republic of North Macedonia",
"iso2": "MK",
"iso3": "MKD",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 17,
"default": 0,
"country": "Romania",
"iso2": "RO",
"iso3": "ROU",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 18,
"default": 0,
"country": "Tunisia",
"iso2": "TN",
"iso3": "TUN",
"postingGroup": 7,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 19,
"default": 0,
"country": "Denmark",
"iso2": "DK",
"iso3": "DNK",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 20,
"default": 0,
"country": "Lithuania",
"iso2": "LT",
"iso3": "LTU",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 22,
"default": 0,
"country": "Bulgaria",
"iso2": "BG",
"iso3": "BGR",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 24,
"default": 0,
"country": "Hungary",
"iso2": "HU",
"iso3": "HUN",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 25,
"default": 0,
"country": "Poland",
"iso2": "PL",
"iso3": "POL",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 26,
"default": 0,
"country": "Portugal",
"iso2": "PT",
"iso3": "PRT",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 28,
"default": 0,
"country": "United Kingdom",
"iso2": "GB",
"iso3": "GBR",
"postingGroup": 7,
"currency": {
"id": 4,
"iso": "GBP",
"currency": "Pound Sterling"
}
},
{
"id": 29,
"default": 0,
"country": "Switzerland",
"iso2": "CH",
"iso3": "CHE",
"postingGroup": 7,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 30,
"default": 0,
"country": "Austria",
"iso2": "AT",
"iso3": "AUT",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 31,
"default": 0,
"country": "Liechtenstein",
"iso2": "LI",
"iso3": "LIE",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 32,
"default": 0,
"country": "Luxembourg",
"iso2": "LU",
"iso3": "LUX",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 33,
"default": 0,
"country": "Norway",
"iso2": "NO",
"iso3": "NOR",
"postingGroup": 7,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 34,
"default": 0,
"country": "South Africa",
"iso2": "ZA",
"iso3": "ZAF",
"postingGroup": 7,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 35,
"default": 0,
"country": "Estonia",
"iso2": "EE",
"iso3": "EST",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 36,
"default": 0,
"country": "Finland",
"iso2": "FI",
"iso3": "FIN",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 37,
"default": 0,
"country": "Greece",
"iso2": "GR",
"iso3": "GRC",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 38,
"default": 0,
"country": "Latvia",
"iso2": "LV",
"iso3": "LVA",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 39,
"default": 0,
"country": "Slovenia",
"iso2": "SI",
"iso3": "SVN",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 40,
"default": 0,
"country": "Slovakia",
"iso2": "SK",
"iso3": "SVK",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 41,
"default": 0,
"country": "Czechia",
"iso2": "CZ",
"iso3": "CZE",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 42,
"default": 0,
"country": "Ireland",
"iso2": "IE",
"iso3": "IRL",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
},
{
"id": 43,
"default": 0,
"country": "Sweden",
"iso2": "SE",
"iso3": "SWE",
"postingGroup": 6,
"currency": {
"id": 1,
"iso": "EUR",
"currency": "Euro"
}
}
]
}
Since we will store the information in a file we don’t need any tables to be created.