Networks
Introduction
The Networks API method allows you to list the supported mobile networks, including information like network prefixes for each network/country. These are the networks available for domestic transactions. The networks available for cross-border transactions will be different. Please contact support to get an updated list of networks available for cross border transactions. If you bring your own paybill or manage your own float, this may affect which networks you can transact with.
The network api endpoint is:
The Network object
Field | Type | Description |
---|---|---|
id | long integer | Unique object identifier |
name | string | The network name |
country | object | Expanded country object |
phone_regex | string | The regular expression for phone numbers belonging to the network, in posix format |
Note
Sample Response (JSON) - if you use one of the development libraries, this is automatically converted into a native object for you:
{
"id": 15,
"name": "HALOTEL",
"country": {
"iso": "TZ",
"iso3": "TZA",
"iso_numeric": 834,
"name": "TANZANIA, UNITED REPUBLIC OF",
"printable_name": "Tanzania, United Republic of",
"phone_prefix": "255",
"supported": true
},
"phone_regex": "^[[.plus-sign.]]25562[0-9]{7}"
}
Retrieving a Single Network
To retrieve a single network, provide the network id and a network object will be returned.
Parameter (*required field) | Type | Description |
---|---|---|
id | Integer Ex. 15 | The id of the network you want to retrieve |
Sample Request
curl https://api.mfsafrica.com/api/networks/15 -H "Authorization: Token ab594c14986612f6167a975e1c369e71edab6900"
package com.beyonic.samples;
import com.beyonic.exceptions.BeyonicException;
import com.beyonic.models.*;
Beyonic.API_KEY = "ab594c14986612f6167a975e1c369e71edab6900";
String response = null;
try{
response = new Network().get(123);
System.out.println(response);
}
catch (Exception e){
e.printStackTrace();
}
<?php
require_once('./lib/Beyonic.php');
Beyonic::setApiKey("ab594c14986612f6167a975e1c369e71edab6900");
$account = Beyonic_Currency::get(15);
?>
import beyonic
beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'
network = beyonic.Network.get(15)
require 'beyonic'
Beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'
network = Beyonic::Network.get(15)
Sample Response
{
"id": 15,
"name": "HALOTEL",
"country": {
"iso": "TZ",
"iso3": "TZA",
"iso_numeric": 834,
"name": "TANZANIA, UNITED REPUBLIC OF",
"printable_name": "Tanzania, United Republic of",
"phone_prefix": "255",
"supported": true
},
"phone_regex": "^[[.plus-sign.]]25562[0-9]{7}"
}
Listing all networks
To retrieve a list of all networks, make a GET request to the network's endpoint. This will return a list of networks.
Sample Request
curl https://api.mfsafrica.com/api/networks -H "Authorization: Token ab594c14986612f6167a975e1c369e71edab6900"
package com.beyonic.samples;
import com.beyonic.exceptions.BeyonicException;
import com.beyonic.models.*;
Beyonic.API_KEY = "ab594c14986612f6167a975e1c369e71edab6900";
String response = null;
try{
response = new Network().list(null, null);
System.out.println(response);
}
catch (Exception e){
e.printStackTrace();
}
<?php
require_once('./lib/Beyonic.php');
Beyonic::setApiKey("ab594c14986612f6167a975e1c369e71edab6900");
$accounts = Beyonic_Currency::getAll();
?>
import beyonic
beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'
networks = beyonic.Network.list()
require 'beyonic'
Beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'
networks = Beyonic::Network.list
Sample Response
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 15,
"name": "HALOTEL",
"country": {
"iso": "TZ",
"iso3": "TZA",
"iso_numeric": 834,
"name": "TANZANIA, UNITED REPUBLIC OF",
"printable_name": "Tanzania, United Republic of",
"phone_prefix": "255",
"supported": true
},
"phone_regex": "^[[.plus-sign.]]25562[0-9]{7}"
},
{
"id": 14,
"name": "AIRTEL-TIGO",
"country": {
"iso": "RW",
"iso3": "RWA",
"iso_numeric": 646,
"name": "RWANDA",
"printable_name": "Rwanda",
"phone_prefix": "250",
"supported": true
},
"phone_regex": "^[[.plus-sign.]]250(72|73)[0-9]{7}"
}
]
}
Filtering Networks
The Networks API doesn’t currently support filtering.
Updated about 1 month ago