Yay.com loading


Error Sorry


Shopping Basket

Basket Total



Delete everything from your basket?

Go to Checkout
Back to latest posts

VoIP API Code Examples - C# and PHP

VoIP API Code Examples - C# and PHP

The two code snippets below show how to send a basic GET request to the Yay.com API using C# and PHP, the C# snippet has been tested using .NET Core and will work across all supported .NET platforms

C# Example

var dict = new Dictionary<string, string> {
    {"X-Auth-Reseller", "yay"},
    {"X-Auth-User", "admin"},
    {"X-Auth-Password", "password"}

var client = new HttpClient {
    BaseAddress = new Uri("https://api.yay.com/authenticated"),
    DefaultRequestHeaders = {
        UserAgent = {
            new ProductInfoHeaderValue("ApiExample", "1.0")

foreach (var key in dict.Keys) {
    client.DefaultRequestHeaders.Add(key, dict[key]);

var response = client.GetAsync("").Result;
if (!response.IsSuccessStatusCode) return;

var jsonResponse = response.Content.ReadAsStringAsync().Result;

PHP Example

The example below uses the Httpful library for ease of integration

// We use the httpful library for ease

try {

    $response = \Httpful\Request::get('https://api.yay.com/authenticated')
                'X-Auth-Reseller' => 'yay',
                'X-Auth-User' => 'admin',
                'X-Auth-Password' => 'password'


} catch (\Httpful\Exception\ConnectionErrorException $e) {
Back to latest posts

Blog Archive

ISO 27001 Business Continuity Accreditation ISO 22301 Business Continuity Accreditation Cyber Essentials Certificate of Assurance G-Cloud accredited by the Crown Commercial Service