Jump to content

WHMCS API Json problem


nowinz

Recommended Posts

Hello,

ich have read many tutorials but my brain has paket loss :wall1:

I will use API for my dashing board (TV) but is not working for me

here my php code 

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://blub.de/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'GetTicketCounts',
            // See https://developers.whmcs.com/api/authentication
             'username' => 'xxxxxmycode',
            'password' => mycode',
            'ignoreDepartmentAssignments' => false,
            'includeCountsByStatus' => true,
            'responsetype' => 'json',
        )
    )
);

$response = curl_exec($ch);
if (curl_error($ch)) {
    die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch));
}
curl_close($ch);

// Decode response
$jsonData = json_decode($response, true);

// Dump array structure for inspection
var_dump($jsonData);

-------

output

in browser 

{"result":"success","filteredDepartments":[1,2,3,4,5,6,7],"allActive":20"awaitingReply":10,"flaggedTickets":0,"status":{"open":{"title":"Open","count":4},"answered":{"title":"Answered","count":95},"customerreply":{"title":"Customer-Reply","count":6},"closed":{"title":"Closed","count":512},"onhold":{"title":"On Hold","count":0},"inprogress":{"title":"In Progress","count":0}}}int(1)


how can dump/parse for example only awaitingReply i need only one output.

 

 

Edited by WHMCS ChrisD
Moved code into code boxes
Link to comment
Share on other sites

  • 3 weeks later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated