Skip to main content

Documentation

List Countries

Retrieve a list of all countries.

Code Samples
    • .NET

      • using System;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        string result = RapydApiRequestSample.Utilities.MakeRequest("GET", "/v1/data/countries");
        
                        Console.WriteLine(result);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error completing request: " + e.Message);
                    }
                }
            }
        }
    • JavaScript

      • const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;
        
        async function main() {
          try {
            const result = await makeRequest('GET', '/v1/data/countries');
        
            console.log(result);
          } catch (error) {
            console.error('Error completing request', error);
          }
        }
    • PHP

      • <?php
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        
        try {
            $object = make_request('get', '/v1/data/countries');
            var_dump($object);
        } catch(Exception $e) {
            echo "Error: $e";
        }
        ?>
    • Python

      • from pprint import pprint
        
        from utilities import make_request
        
        response = make_request(method='get',
                                path='/v1/data/countries')
        
        pprint(response)
  • /v1/data/countries

  • List Countries

  • curl -X get
    https://sandboxapi.rapyd.net/v1/data/countries
    -H 'access_key: your-access-key-here'
    -H 'Content-Type: application/json'
    -H 'salt: your-random-string-here'
    -H 'signature: your-calculated-signature-here'
    -H 'timestamp: your-unix-timestamp-here'
    
  • {
        "status": {
            "error_code": "0",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "cf6d191d-088b-41e0-a080-3afe31f3a005"
        },
        "data": [
            {
                "id": 127,
                "name": "Afghanistan",
                "iso_alpha2": "AF",
                "iso_alpha3": "AFG",
                "currency_code": "AFN",
                "currency_name": "Afghan afghani",
                "currency_sign": "؋",
                "phone_code": "93"
            },
            {
                "id": 128,
                "name": "Åland Islands",
                "iso_alpha2": "AX",
                "iso_alpha3": "ALA",
                "currency_code": "EUR",
                "currency_name": "Euro",
                "currency_sign": "€",
                "phone_code": "358"
            }
        ]
    }