使用soap api显示所有otrs门票

时间:2016-07-11 06:02:07

标签: php soap xml-rpc otrs

如何使用soap api显示所有otrs门票。可以通过在URL中传递票证ID来显示个人票证,如下所示:

$url = "https://url/otrs/rpc.pl"; //// URL for OTRS server
$username = "username"; //// SOAP username set in sysconfig
$password = "password"; //// SOAP password set in sysconfig
$TicketID = $_GET['id'];
  //////// Initialize new client session ////////
    $client = new SoapClient(
        null,
        array(
            'location' => $url,
            'uri' => "Core",
            'trace' => 1,
            'login' => $username,
            'password' => $password,
            'style' => SOAP_RPC,
            'use' => SOAP_ENCODED
        )
    );
//////// Create and send the SOAP Function Call ////////
    $sql =
    $TicketDetails = $client->__soapCall("Dispatch",
        array($username, $password,
            "TicketObject", "TicketGet",
            "TicketID", $TicketID,
        ));
 $ticketInfo = array();
    $i = 0;

    foreach ($TicketDetails as $name => $value){ //// explode the xml response
        if (false !== strpos($name, "s-gensym")){

            $temp[$i] = $value;
            $v = $temp[$i - 1];
            if($i % 2 != 0){
                $ticketInfo[$v] = $value;
            }
            $i++;
        }
    }
 var_dump($ticketInfo);
    exit();

如何使用api ?????

显示所有门票

1 个答案:

答案 0 :(得分:2)

使用TicketSearch API call检索故障单ID列表。然后将此列表提供给TicketGet,如您已经显示的那样,以便检索票证详细信息。