View/donation

The view/donation/box api request returns a donation box.

Version

1.0.0

Request Parameters

Parameter Valid Input Default Required Description
customer_id unsigned integer - yes The customer_id the data should be requested for
token string - yes The token generated for this request. See token for more information
css string null no Include your css-file via url
target unsigned integer null no Your donation goal
from string (datetime) First day of current month no Start date
to string (datetime) Last day of current month no End date
legend array null no Configure legend


Legend-parameter Valid Input Default Required Description
show boolean true no Activate/deactivate legend
current string "Donations" no Display name above current donation
target string "Goal" no Display name above donation goal

Examples

For all examples we are using GuzzleHttpClient.

Get voiceserver from customer_id 1

<?php 

use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;

function getVoiceserver() {
    try {
        $client = new Client();
        $response = $client->post('https://my.ngz.net/api/view/donation/box',
            array(
                'json' => array(
                    'customer_id' => 1,
                    'token' => 'C9FBFB090B8E6BBB1EED94D2259F94D98CDBCB57A710558DA0',
                    'css' => 'https://www.ngz-server.de/viewer.css',
                    'from' => '2015-01-01',
                    'to' => '2015-12-31',
                    'legend' => array(
                        'show' => 'true',
                        'target' => 'Goal',
                        'current' => 'Donations'
                    )
                )
            )
        );
    } catch (ClientException $e) {
        throw new Exception($e->getResponse()->getBody()->getContents(), $e->getResponse()->getStatusCode());
    }
    if(is_object($response) && $response->getStatusCode() == 200) {
        $reply = json_decode($response->getBody()->getContents());
    }
    return $reply;
}

Sample output

<?php
Array 
{
    [0] => "<iframe class="view_donation" src="https://my.ngz.net/api/views/donation_iframe.php?i=eyJhIjo3NDYuNSwiZCI6OD
        AwLCJjc3MiOiJodHRwczpcL1wvd3d3Lm5nei1zZXJ2ZXIuZGVcL21lZGlhXC9OR1pcL2LCJjdXJyZW50IjoiRG9uYXRpb25zIn19"></iframe>"
}

Sample view

Copyright 2016 by United Gameserver GmbH. Alle Rechte vorbehalten.V3.1.5.1337