Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Soap

1235»

Comments

  • Now I was succesful in opening a ticket with this code:

    $args = array(
    'username' => 'apiuser',
    'password' => 'sLk32sDi1',
    'origin' => 'Web',
    'alertUser' => true,
    'alertStaff' => true,
    'ticketData' => array(
    'name' => $_POST[\"txtName\"],
    'email' => $_POST[\"txtEmail\"],
    'subject' => $_POST[\"txtBetreff\"],
    'message' => $_POST[\"areaBeschreibung\"],
    'topicId' => $_POST[\"cmbTyp\"], //topic Website Support
    'deptId' => 2, //department Support
    'staffId' => null,
    'duedate' => null,
    'time' => null,
    'pri' => $_POST[\"cmbPrio\"], // default priority
    'phone' => null,
    'source' => null,
    )
    );


    But there are still problems:
    No matter what value is in $_POST["cmbPrio"] (1, 2 or 3), the priority can´t be set correctly. If topicId is 1, the priority is always 3 and if topicId is 2 the priority is always 2. I have absolutely no clue, why!

    Please help.

    BeSt
  • Per user request

    Hi Cyberde,

    Now that my install is working, I've been playing around a bit with the method but can't find a specific method to get specific user ticket. For example, I would like to have all the ticket for user X. The only option I see presently is to use the listByStatus method and than filter the data for my user (email). However, this won't be good for performance since each time it will get the whole list of ticket in the database and not only those ticket for the user.

    Is my understanding correct? Is there another to be more efficicient ot get the same result? Will user method be added to the service or is it hard to add one?

    My site is more toward the user (with is email) and will use open ticket method, a list of ticket for user method and the othermethod based on ticket number. I'm only missing the middle one.

    Hope you can help!

    UPDATE:
    For my point above, I was able to work-around by accessing the database directly but I have a new issue and a new question.
    1. An additional question, is there any plan for attachment support?
    2. I've been successful in using function ticketOpen and getStatus but got error message when using getMessages or getNotes
    Fatal error: Uncaught SoapFault exception: [HTTP] Internal Server Error in /home/bennyb5/public_html/get_status.php:17 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://www.benn...', 'http://www.benn...', 1, 0) #1 /home/bennyb5/public_html/get_status.php(17): SoapClient->__call('ostTicket.getMe...', Array) #2 {main} thrown in /home/bennyb5/public_html/get_status.php on line 17
    My code is
    //Connect to webservice
    include "includes/ost_ws_connect.php";

    // Set up the parameters
    $args = array(
    'username' => $ost_ws_user,
    'password' => $ost_ws_pass,
    'ticketId' => 431384);

    // Send the request and receive the status (eg Open, Closed)
    try {
    $result = $osticket->__call('ostTicket.getMessages',$args);
    }
    catch (SoapFault $e) {
    throw $e;
    }
    print_r($result);
    where line 17 is the call to getMessages.

    I'm a bit stuck since the same code but with getStatus function is working great. What could be the problem?

    I'm on OsTicket 1.7
  • Zapier

    Would it be possible to use this mod with zapier?

    Tried to get it to work, but when choosing webhook, i dont know how to enter the fields: payload, data, basic auth and headers.

    Any ideas?
  • Is there a chance to assign a ticket to a team instead a staff?
  • SOAP Binding

    Hello,

    I was wondering if it would be possible to switch the soap binding used in the wsdl to a newer and better supported binding such as document or literal. the RPC-encoded is somewhat out of data these days. It would help me support it with JAX-WS.


    <soap:binding style=\"rpc\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>
    <operation name=\"ostDepartment.getInfo\">
    <soap:operation soapAction=\"http://10.53.151.184/api/soap/index.php/ostDepartment.getInfo\" style=\"rpc\"/>
    <input>
    <soap:body use=\"encoded\" namespace=\"http://10.53.151.184/api/soap/\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"/>
    </input>
    <output>
    <soap:body use=\"encoded\" namespace=\"http://10.53.151.184/api/soap/\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"/>
    </output>
    </operation>



    Thanks so much.
  • need help

    Dears
    I need your support to get clear tutorial of this script due to I am try to use it under shell script

    I am new on php so i follow your instructions here and I can login my site everything ok in index.php

    www.mysite.com/osticket/api/soap/

    what is the next step if i want to see status of TT .shall i need to create new php page like below and what is the directory i have to put it in
    and if i put this php script on same server which have the osticket script that will be working ?

    openstatus.php

    <?php
    $osticket = new SoapClient('http://mysite.com/osticket/api/soap/index.php?wsdl');

    // Set up the parameters
    $args = array(
    'username' => 'mylogin',
    'password' => 'mypass',
    'ticketId' => 679664
    );

    try {
    // Send the request and receive the status (eg Open, Closed)
    $result = $osticket->__soapCall('ostTicket.getStatus',$args);
    }
    catch (SoapFault $e) {
    throw $e;
    }
    ?>



    when i upload above php page openstatus.php
    to /api/soap diretory
    and access this page nothing appear it is only white page
    my osticket version

    System Preferences and Settings (v1.6 ST)


    thanks for your support
  • edited November 2013
    First user having a problem:
    SuperEdmundo;n42819 said:
    Error: Cannot use object of type Ticket as array in ticket.class.php
    ...

    I get this error in error_log:
    PHP Fatal error: Cannot use object of type Ticket as array in ticket.class.php on line 270

    This is line 270
    if (isVersion('1.7'))
    {
    if($thread = $ticket->getThread(false)) {
    $message = null;

    foreach($thread as $entry) {
    ->270 switch ($entry['thread_type'])
    {
    case 'M':
    if ($message != null)
    $messages[] = $message;


    I am using version 1.7
    Thanks in advaced

    Second user having a problem:
    david.landry;n44069 said:
    Per user request

    ...
    2. I've been successful in using function ticketOpen and getStatus but got error message when using getMessages or getNotes

    My code is where line 17 is the call to getMessages.

    I'm a bit stuck since the same code but with getStatus function is working great. What could be the problem?

    I'm on OsTicket 1.7

    Third user having a problem:
    RobertPop;n73904 said:
    Hi! I'm trying to use the postMessage service but nothing new appears in the messages list. I get no errors, but simply nothing happens. Also, when I post a new message manually from the admin section, I get a message that says that the ticket is not on LOCK MODE (I'm sure TICKET LOCKING is enabled - I checked that in the Admin Panel section). Please help me out!

    Here's my code:

    $osticket = new SoapClient('http://dev.bannersnack.net/osticket/api/soap/index.php?wsdl');

    // Set up the parameters
    $args = array(
    'username' => 'admin',
    'password' => '123456',
    'ticketId' => 959320,
    'message' => utf8_encode('This is a new note to this ticket, yay!')
    );

    try {
    // Post new message and receive the messageID
    $result = $osticket->__call('ostTicket.postMessage',$args);
    }
    catch (SoapFault $e) {
    throw $e;
    }

    print_r($result);

    BUG REPORT:
    I'm apparently the fourth person in this thread to have problems with getMessages (and possibly postMessage / getNotes) when using Osticket 1.7.

    My code using these functions was working fine when running osTicketMOD-SOAPv1.5-56 on osTicket 1.6, but when I upgraded osTicket from 1.6 to 1.7.3, these methods no longer work. Here's the error in my Apache logs when I use getMessages:



    [Thu Nov 07 23:39:54 2013] [error] [client XXX.XXX.180.67] PHP Warning: Illegal string offset 'thread_type' in /var/www/my.example.com/htdocs/support/api/soap/lib/classes/ticket.class.php on line 270

    [Thu Nov 07 23:39:54 2013] [error] [client XXX.XXX.180.67] PHP Fatal error: Cannot use object of type Ticket as array in /var/www/my.example.com/htdocs/support/api/soap/lib/classes/ticket.class.php on line 270

    [Thu Nov 07 23:39:54 2013] [error] [client XXX.XXX.111.5] PHP Fatal error: Uncaught SoapFault exception: [HTTP] Internal Server Error in /var/www/my.example.com/htdocs/IndexUI.php:124
    Stack trace:
    #0 [internal function]: SoapClient->__doRequest('<?xml version=\"...', 'https://my.exam...', 'https://my.exam...', 1, 0)
    #1 /var/www/my.example.com/htdocs/IndexUI.php(124): SoapClient->__soapCall('ostTicket.getMe...', Array)
    #2 /var/www/my.example.com/htdocs/IndexUI.php(221): IndexFunction->ostSoap(Array, 'ostTicket.getMe...')
    #3 /var/www/my.example.com/htdocs/IndexUI.php(347): IndexFunction->ShowTicket('748053')
    #4 /var/www/my.example.com/htdocs/IndexUI.php(63): IndexFunction->Ticket()
    #5 /var/www/my.example.com/htdocs/action.php(10): IndexFunction->WhatToDo('Show', 'Ticket')
    #6 {main}
    thrown in /var/www/my.example.com/htdocs/IndexUI.php on line 124, referer: https://my.example.com/


    Is there any fix/workaround for this?
  • edited November 2013
    I need to correct myself and edit this post. I found out where the issue was on my end and while the code shouldn't be calling deprecated functions (soapclient->__call()) it will actually work. I'm not using topics but you can't pass null as a topicId value. You have to pass an empty string. I still made a few changes on my end for the call and here is a sample.

    Also I updated the version function in common.inc to show 1.7 (set to 1.6) and you cannot use soapclient native method call of soapclient->method() since the methods defined in this service have periods in the name. However here is a functioning call.

    <?
    $osticket = new SoapClient("http://host.domain.com/osticket/api/soap/index.php?wsdl");

    $message = <<<EOF
    This is a free form
    message example.
    EOF;

    $args = array(
    'username' => 'admin',
    'password' => 'passw0rd',
    'origin' => 'Web',
    'alertuser' => true,
    'alertstaff' => true,
    'ticketData' => array(
    'name' => utf8_encode("Security Monitoring"),
    'email' => utf8_encode("netsec@domain.com"),
    'subject' => utf8_encode("Sample Title"),
    'message' => utf8_encode($message),
    'source' => utf8_encode("Alert"),
    'topicId' => '', // If you don't have topics set, do not use null. It will not work.
    'deptId' => 2, // Change to meet your needs
    'staffId' => null,
    'duedate' => null,
    'time' => null,
    'pri' => 2,
    'phone' => null,
    )
    );

    $result = $osticket->__soapCall("ostTicket.open", $args);
    print "Result $result";

    ?>
  • edited December 2013
    Hi all,

    My apologies for not responding for such a long time. Since I've migrated my mail server, I apparently forgot to update the MX records for the domain where this forum sends it emails to, so they all went to my MX fallback server, so I didn't notice anything going on here :(

    I will try to see if I can fix the problems with the getMessages for versions > 1.7.x this weekend and will report back here once fixed!
    Do note I have to do this in my free time (and I didn't get any donations yet) so I will try my best!

    Best regards,
    cyberde
Sign In or Register to comment.