Countries Data
This page provides information about the countries data used in the Nowallet API. The countries data is used to identify the country code and its corresponding currency for payment transactions.
To get the list of countries and their corresponding currency codes, phone length, and more, you can use the following endpoint:
{baseUrl}/countries/dataFor example, if you want to get specific data about Cameroon, you can use the following URL:
{baseUrl}/countries/data?country=CM.
Request Parameters
When retrieving the countries data, the request must include the following parameters in the URL:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| country | query | string | false | country code will be checked, return all countries if empty or not provided |
Code Samples in Multiple Languages
To help you integrate the NoWallet API seamlessly, we provide code samples in various programming languages. These examples demonstrate how to make a request to the API endpoint and handle the response.
- Shell (cURL): For quick testing and command-line usage.
- HTTP: Raw HTTP request format for understanding the structure.
- JavaScript: Using
fetchfor browser or Node.js environments. - Ruby: Using the
rest-clientlibrary for Ruby applications. - Python: Using the
requestslibrary for Python projects. - PHP: Using
GuzzleHttpfor PHP integrations. - Java: Using
HttpURLConnectionfor Java applications. - Go: Using the
net/httppackage for Go projects.
Example Request
Below is an example of how to retrieve the countries data using different languages. Select the tab corresponding to your preferred language to view the implementation.
Ensure you replace {access-token} with your actual API token and provide the required request parameters.
- cURL
- HTTP
- JavaScript
- Ruby
- Python
- PHP
- Java
- Go
# Exemple de commande cURL pour obtenir les données des pays
curl -X GET {baseUrl}/countries/data \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET {baseUrl}/countries/data HTTP/1.1
Accept: application/json
const headers = {
Accept: "application/json",
Authorization: "Bearer {access-token}",
};
fetch("{baseUrl}/countries/data", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get '{baseUrl}/countries/data',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('{baseUrl}/countries/data', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','{baseUrl}/countries/data', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("{baseUrl}/countries/data");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "{baseUrl}/countries/data", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
Response Parameters
The response from the API will include the following parameters:
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | countries fetched successfully | Inline |
| 400 | Bad Request | Bad Request possible errors | None |
Response Types
The response from the API will include the following parameters in JSON format:
Success Response (200 OK)
Example response for a successful request
{
"code": "CM",
"name": "Cameroon",
"indicatif": "+237",
"currency": "XAF",
"phone_length": 8
}
Error Response (400 Bad Request)
{
"statusCode": 400,
"error": "COUNTRY_CODE_NOT_FOUND",
"message": "It seems that this country code does not exist or You can't perform this action, this token does not allow you"
}
Enumerated Values
| Property | Value |
|---|---|
| code | DZ |
| code | AO |
| code | BJ |
| code | BW |
| code | BF |
| code | BI |
| code | CM |
| code | CV |
| code | CF |
| code | TD |
| code | KM |
| code | CG |
| code | CD |
| code | CI |
| code | DJ |
| code | EG |
| code | GQ |
| code | ER |
| code | ET |
| code | GA |
| code | GM |
| code | GH |
| code | GN |
| code | GW |
| code | KE |
| code | LS |
| code | LR |
| code | LY |
| code | MG |
| code | MW |
| code | ML |
| code | MR |
| code | MU |
| code | YT |
| code | MA |
| code | MZ |
| code | NA |
| code | NE |
| code | NG |
| code | RE |
| code | RW |
| code | ST |
| code | SN |
| code | SC |
| code | SL |
| code | SO |
| code | ZA |
| code | SS |
| code | SD |
| code | SZ |
| code | TZ |
| code | TG |
| code | TN |
| code | UG |
| code | EH |
| code | ZM |
| code | ZW |
Was this page helpful?