Hello World Example

Reading Time: 2 minutes

Let’s see how to list, for example, users. Save the following code as ‘vcc-db-api.php’ onto your web server, then open it, change the credential information as required (see: Authentication and Security, and finally save it.

// settings
$customer = 'CUSTOMER';
$password = 'PASSWORD';
// build Database API URL
$url = sprintf('https://%s:%s@%s.asp.virtual-call-center.eu', $customer, $password, $customer);
// build resource
$resource = $url . '/v2/users';
// send HTTP GET request to API and obtain the result
$http_response = file_get_contents($resource);

if ($http_response === false) {
    // there is an error
    $last_error = error_get_last();
    echo "Connection error:n" . $last_error['message'] . "nn";
// $http_response_header global var contains HTTP response code
list(, $http_response_code) = explode(' ', $http_response_header[0]);
// check if HTTP response is OK
if ($http_response_code != 200) {
    // there is an error
    echo 'Database API error code: ' . $http_response_code . "nn";
echo "Output in JSON format:n" . $http_response . "nn";

// convert json structure into php array
$vcc_users = json_decode($http_response, true);

// print users array
echo "Output as PHP array:n";
echo "nn";

Type the URL into any browser (e.g.: http://your.url/vcc-db-api.php), press Enter, and check the output on your screen, which should look similar to the following:

    "response": [
            "status": "active",
            "name": "Admin",
            "username": "admin",
            "extension": "4",
            "userid": 4,
            "teams_name": "default_team",
            "group_name": "admin"
            "status": "active",
            "name": "Supervisor",
            "username": "supervisor",
            "extension": "5",
            "userid": 5,
            "teams_name": "default_team",
            "group_name": "supervisor"
            "status": "active",
            "name": "mozmill operator",
            "username": "mozmill_operator",
            "extension": "104",
            "userid": 9,
            "teams_name": "default_team",
            "group_name": "operator"
    "errors": []

Using http://jsonlint.com/ you can convert JSON texts into a readable format, and also validate them. The example code should hopefully be easy to understand, but one section may need some explanation. When you call file_get_contents() function it returns with the HTTP response body and also sets the $http_response_header global variable. It should be checked whether the HTTP response code is 200 or not. If it is not, please check HTTP Response Codes for possible errors.

Note: Do not use this code in production, as the file_get_contents() function is not able to send HTTP POST, PUT and DELETE requests. The above code is only for demonstration.

There are no comments yet.
Subscribe to our newsletter
or Contact us!
Please note that by subscribing to our newsletter, you agree to receive regular email messages from VCC Live® about service related news and updates. By subscribing to our newsletter, you also agree that VCC Live® will use your data in accordance with the applicable Privacy Policy until you unsubscribe from the newsletter.

Privacy Settings Center


Necessary cookies are essential in order to navigate around a website and use its basic features. You must accept these cookies as the website cannot function properly without them.



Marketing cookies are used to track visitors across websites and deliver advertisements that are more relevant and engaging to you.



Statistic cookies collect data to help us understand how visitors use our websites and are used to improve the user experience. These cookies don’t collect personal information and cannot identify visitors.



Other cookies are those cookies that do not fall into the categories above. These cookies are in the process of being classified.