【问题标题】:how to get ticket details of multiple ticket IDs through OTRS REST URL如何通过 OTRS REST URL 获取多个工单 ID 的工单详细信息
【发布时间】:2018-04-29 16:01:35
【问题描述】:

目前我将此 URL 用于单票 ID:http:///otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket/2020?UserLogin=abc&Password=abc123&DynamicFields=1

如何将多个票证 ID 传递到此 URL..

【问题讨论】:

    标签: rest web-services rest-client otrs advanced-rest-client


    【解决方案1】:

    你不能。您应该只在代码中使用循环,并为每个 TicketID 调用 Web 服务。

    【讨论】:

    • 是的,我们可以做到。只需提供逗号分隔的票证 ID。谢谢你的回复
    【解决方案2】:

    这里是otrs6 rest api的例子,带有ticketget的通用接口

    <?php
    
    require_once 'otrs6composer/vendor/autoload.php';
    
    Unirest\Request::defaultHeader("Accept", "application/json");
    Unirest\Request::defaultHeader("Content-Type", "application/json");
    Unirest\Request::verifyPeer(true);
    
    function otrs_ticket_detail_listing($ticket) {
    
    $title = "";
    $state = "";
    $type = "";
    $queue = "";
    $output = "";
    
    $TicketNr = $ticket;
    $BaseURL2 = 'http://10.247.142.10/otrs/nph-genericinterface.pl/Webservice/TicketConGeneric/TicketGet';
    $BaseURL1 = 'http://10.247.142.10/otrs/nph-genericinterface.pl/Webservice/TicketConGeneric/Session/SessionCreate';
    $headers = [];
    $body = json_encode(
        [
            "UserLogin" => "root@localhost",
            "Password"  => "nic123",
        ]
    );
    
    /**
     * SessionCreate
     *
     * http://doc.otrs.com/doc/api/otrs/stable/Perl/Kernel/GenericInterface/Operation/Session/SessionCreate.pm.html
     */
    $response = Unirest\Request::post($BaseURL1, $headers, $body);
    
    if (!$response->body->SessionID) {
        print "No SessionID returnd \n";
        exit(1);
    }
    $SessionID = $response->body->SessionID;
    
    
    
    /**
     * TicketGet
     *
     * http://doc.otrs.com/doc/api/otrs/stable/Perl/Kernel/GenericInterface/Operation/Ticket/TicketGet.pm.html
     */
    $param = [
        'SessionID' => $SessionID,
    ];
    $ArticleGet = Unirest\Request::get($BaseURL2."/".$TicketNr, $headers, $param);
    
    
    
    return $ArticleGet;
    //var_dump($response);
    
    
    }
    
    
    ?>
    

    【讨论】:

    • @Partho63 只需调用该函数并传递 tickedId 即可获得 json
    猜你喜欢
    • 2017-02-22
    • 1970-01-01
    • 2020-10-08
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-17
    相关资源
    最近更新 更多