List States

The List States operation allows you to search for states of the given country available in the Fax.to coverage.

To use the List States API:

    Create a request and get list of states:

    #!/bin/bash
    curl -X GET --header 'Content-Type: application/json' 'https://fax.to/api/v2/states/{COUNTRY_CODE}?api_key=API_KEY'
    
    <?php
    
    $defaults = [
      CURLOPT_URL => 'https://fax.to/api/v2/states/{COUNTRY_CODE}?api_key=API_KEY'
    ];
    
    $ch = curl_init();
    curl_setopt_array($ch, $defaults);
    
    $response = curl_exec($ch);
    
    // Decode the json object you retrieved when you ran the request.
    $decodedResponse = json_decode($response, true);
    var_dump($decodedResponse);
    
    
    import urllib
    
    params = {
        'api_key': 'API_KEY'
    }
    
    url = 'https://fax.to/api/v2/states/{COUNTRY_CODE}?' + urllib.urlencode(params)
    response = urllib.urlopen(url)
    print response.read()
    
    require "net/http"
    require "uri"
    
    uri = URI.parse("https://fax.to/api/v2/states/{COUNTRY_CODE}?api_key=API_KEY")
    
    response = Net::HTTP.get(uri)
    
    puts response
    
    
    // Sample Output.
    {
      "status": "success",
      "states" :[
        {
          "id": "1",
          "name": "Alabama",
          "code": "AL",
        },
        {
          "id": "2",
          "name": "Alaska",
          "code": "AK",
        }
        ...
    }