Number of queued calls

You need your AfricasTalking username and APIKey for any request to our API. If you don't have an APIKey, please click here to get one.

The C# code snippet below shows how you can get number of queued calls of your Africas Talking phone number using our API.

The code uses our C# gateway class: AfricasTalkingGateway.cs [ Download]

To help decode JSON responses, you will need to add a reference to System.Web.Extensions and System.Microsoft.CSharp

using System;

class MainClass
	static public void Main (){
		// Specify your login credentials
		string username = "MyAfricasTalking_Username";
		string apiKey   = "MyAfricasTalking_APIKey"; 
		// Specify your AfricasTalking phone number in international format.
		// Comma separate them for more than one number
		string phoneNumber = "+254711082XXX";
		// Create a new instance of our awesome gateway class
		AfricasTalkingGateway gateway = new AfricasTalkingGateway (username, apiKey);

		// Wrap the call in a try-catch block 
		// Any gateway errors will be captured by our custom Exception class below
		try {

			dynamic results = gateway.getNumQueuedCalls(phoneNumbers);
            // For a specific queue, specify the queue name eg:
            // string queueName = "myQueueName"
            // dynamic results = gateway.getNumQueuedCalls(phoneNumber, queueName);
			foreach(dynamic result in results) {
			 Console.Write("Phone number: " + result["phoneNumber"]);
			 Console.Write("Queue name: " + result["queueName"]);
			 Console.WriteLine("Number of queued calls: " + result["numCalls"]);

		} catch (AfricasTalkingGatewayException e) {

			Console.WriteLine ("Encountered an error: " + e.Message);		


Our REST resource for getting the number of queued calls is located at: In order to get the number of queued calls, you will need to pass in the following parameters within a POST request:
Variable Name Location Description
apikey Header Your API Key, which you can generate from your dashboard
username Body Your Africa's Talking account username
phoneNumbers Body Your AfricasTalking phone number mapped to your account

You can check the HTTP Response Code to determine whether the request was successful. Any response code other than 201 (Created) indicates that the call was not initiated

Example using CURL client
curl -H "Accept: application/xml" -H "Apikey: fb752d3417021812f0961y6c9464832dd1adb1e555c73f1e7c32bcc006488674" -d "username=myUsername&phoneNumbers=+254711082XXX"