List DID Groups

List DID Groups is a method related to Fax.to’s inventory. It allows you to retrieve the list of DID groups. A DID group can be defined as the smallest set of DIDs which is usually DIDs that share the same city or area code attributes. It is a method which is useful to get pricing info on a DID and to get didGroupIds which is a required parameter when placing a Number order.

To use the List DID Groups API:

    Create a request and get list of DID groups:

    #!/bin/bash
    curl -X GET --header 'Content-Type: application/json' 'https://fax.to/api/v2/countries/{COUNTRY_CODE}/didgroups?api_key=API_KEY&didGroupIds=12,34,67&stateId=12&cityNamePattern=New York%&areaCode=204'
    
    <?php
    
    $defaults = [
      CURLOPT_URL => 'https://fax.to/api/v2/countries/{COUNTRY_CODE}/didgroups?api_key=API_KEY&didGroupIds=12,34,67&stateId=12&cityNamePattern=New York%&areaCode=204'
    ];
    
    $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'
        'didGroupIds': '12, 34, 67'
        'stateId': '12'
        'cityPattern': 'New York%'
        'areaCode': '204'
    }
    
    url = 'https://fax.to/api/v2/countries/{COUNTRY_CODE}/didgroups?' + urllib.urlencode(params)
    response = urllib.urlopen(url)
    print response.read()
    
    require "net/http"
    require "uri"
    
    uri = URI.parse("https://fax.to/api/v2/countries/{COUNTRY_CODE}/didgroups?api_key=API_KEY&didGroupIds=12,34,67&stateId=12&cityNamePattern=New York%&areaCode=204")
    
    response = Net::HTTP.get(uri)
    
    puts response
    
    
    // Sample Output.
    {
      "status": "success",
      "data": [
        {
          "did_group_id": 67,
          "area_code": "204",
          "city_name": "WINNIPEG"
        },
        {
          "did_group_id": 13868,
          "area_code": "226",
          "city_name": "WINDSOR"
        },
        {
          "did_group_id": 9581,
          "area_code": "289",
          "city_name": "WOODBRIDGE"
        },
        {
          "did_group_id": 20287,
          "area_code": "306",
          "city_name": "SASKATOON"
        },
        .....
    }