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

edited December 2013 in Mods and Customizations
Hi all,

After searching for hours I finally found out that there isn't anyway to add tickets to osTicket from a website nor from an application.

So that's why I created a MOD that adds a webservice to osTicket.

The download and documentation can be found here: http://www.cyberde.nl/software-en-US/osticket-soap-mod/.

I've been testing it for a while now and it seems to be stable so why not release it to the community :)

Do you like this MOD and do you want to support me so that I can continue the development? Please make a donation.

Cheers!
«1345

Comments

  • Current features:

    image
  • cyberde;15386 said:
    I'd just want everybody to know that I'm writing a SOAP MOD for osTicket.

    Current features:
    • Add a ticket to the system (open)
    • Query the status of a ticket (getStatus)
    • Get all messages from a ticket (getMessage)
    • Close a ticket (close)
    • Reopen a ticket (reopen)
    • Post a message to a ticket (postMessage)

    Do note that every SOAP call requires an API key bound to the IP of the requester. So it's secure ;)

    Cheers!
    I think this would be cool and would be very interested in it.
  • Okay, I'm giving it the final touches and when it's finished I'll open a new topic for it :)
  • Okay I am going to release it today, I had to update and translate my website first since I want to offer it there :)
  • Hey,

    AWESOME!

    works perfect.

    You saved me from some extra work!
  • pureskills;15515 said:
    Hey,

    AWESOME!

    works perfect.

    You saved me from some extra work!
    Sure thing! That's what communities are for right :)
  • Great mod, but unfortunately, have problem with Cyrillic messages and subjects
  • Fug1t1v3;15736 said:
    Great mod, but unfortunately, have problem with Cyrillic messages and subjects
    How are you using the webservice, with php? If so, could you try using htmlentities or utf8_encode for the Cyrillic subject and message?
  • yes, using php
    already did it using utf8_encode before sending to soap
    but needed to change your soap api, because U already had in ticket creation same command, and it made it double utf8_encode.
    So had to make it before sending, and removed from API
  • Oh okay. I've used utf8_encode there because sending a request from the webservice using Visual Studio would fail bigtime if it had a special character (for instance: é).
    But if it works for you :D
  • also had to make utf8_decode on getting ticket messages
  • Okay I'll have a look at that tomorrow. See if I can reproduce and then will update the mod.

    How exactly are you calling the webservice?
  • I'm using your PHP example from your web page

    made a class for it, and have different functions in it, to make calls to API
  • Ah okay, can you give me an example of a Cyrillic text so I can test this too? :)
  • something like that:
    тестинг, проверка системы тикетов
  • Thnx, I'll have a look at it tomorrow since I've been busy trying to fix inline images from within an email: http://www.osticket.com/forums/showthread.php?p=15821#post15821
  • Hi,

    I've been testing and I uploaded a new version (1.1) of the MOD to my website.
    Fug1t1v3;15740 said:
    also had to make utf8_decode on getting ticket messages
    Apparently this is normal when using the PHP SoapClient, so is using utf8_encode. Otherwise the SoapClient raises an error.
    I have also updated the examples on my website to include this :). I've also tested this with Visual Studio and it recognizes the UTF-8 charset automatically.

    Let me know if this fixes it for you!
  • Will watch it some time later, as I mentioned before, had redone by myself, some lines of your api, so right now it's working
    Also I have some idea, that there should be api functions: to get ticket info, not only it's messages and also a ticket list by e-mail (right now have this done, by pure mysql queries to the database)
  • Fug1t1v3;15898 said:
    Will watch it some time later, as I mentioned before, had redone by myself, some lines of your api, so right now it's working
    Also I have some idea, that there should be api functions: to get ticket info, not only it's messages and also a ticket list by e-mail (right now have this done, by pure mysql queries to the database)
    Okay, I'll have a look into this. I already thought of a function like this, since I'm thinking of building a Windows Application for administrating tickets from my mobile phone.

    If you have more ideas, do share them :) Could you send me your modifications so I could have a look at them and test them?
  • The only thing I have changed was removing utf8_encode on Line 48 from /soap/lib/classes/ticket.class.php

    // make sure the data has the UTF8 charset otherwise DB inserts would fail bigtime
    foreach ($ticketData as $key => $value) {
    $ticketData[$key] = $value;
    }

    and adding utf8_encode before sending info to api (like in your previews now)
    I'm thinking of building a Windows Application for administrating tickets from my mobile phone.
    That would be great
  • Fug1t1v3;15906 said:
    The only thing I have changed was removing utf8_encode on Line 48 from /soap/lib/classes/ticket.class.php

    // make sure the data has the UTF8 charset otherwise DB inserts would fail bigtime
    foreach ($ticketData as $key => $value) {
    $ticketData[$key] = $value;
    }
    and adding utf8_encode before sending info to api (like in your previews now)
    Okay thanks! I'll have a look if I can create something to get all the ticket information. If so, I will update the service again :)
    Fug1t1v3;15906 said:
    That would be great
    That's the idea for now. Now I just need the time :p
  • Right now, I'm using such mysql queries:
    Getting ticket info:

    SELECT
    `t`.`ticketID`,
    `d`.`dept_name`,
    `tt`.`topic`,
    `t`.`subject`,
    `t`.`created`,
    `t`.`status`
    FROM `ost_ticket` AS `t`
    LEFT JOIN `ost_department` AS `d` ON `t`.`dept_id` = `d`.`dept_id`
    LEFT JOIN `ost_help_topic` AS `tt` ON `t`.`topic_id` = `tt`.`topic_id`
    WHERE `email`='$email'
    AND `ticketID`='$tid';

    And getting ticket list, by e-mail and by ticket status:

    SELECT
    `t`.`ticketID`,
    `d`.`dept_name`,
    `tt`.`topic`,
    `t`.`subject`,
    `t`.`created`
    FROM `ost_ticket` AS `t`
    LEFT JOIN `ost_department` AS `d` ON `t`.`dept_id` = `d`.`dept_id`
    LEFT JOIN `ost_help_topic` AS `tt` ON `t`.`topic_id` = `tt`.`topic_id`
    WHERE `email`='$email'
    AND `status`='$status';
    Now I just need the time
    Yeah, the time is always needed..
  • I'm currently expanding the webservice to include almost all ticket related functions that you have in the webinterface.

    Afther that i'll be creating an windows mobile app :)
  • Currently the new version has the folowing functionality:
    • ostTicket.assign
    • ostTicket.close
    • ostTicket.delete
    • ostTicket.getInfo
    • ostTicket.getMessages
    • ostTicket.getStatus
    • ostTicket.open
    • ostTicket.postMessage
    • ostTicket.postNote
    • ostTicket.postReply
    • ostTicket.reopen
    • ostStaff.getInfo
    I'm adding more functionality after I've posted this update :)
  • nice work!
  • New version has been released with a lot of new features. Go check it out! :)

    See link in the first post.

    What's new
    This update of osTicket SOAP MOD adds a lot of new methodes to let you almost fully control tickets from your application/website.
    Also you can use a username and password now instead of an API-key, removing the limitation of using the SOAP-service from just one IP-address.
  • Hi cyberde,
    Just found this mod as I was looking to add tickets/info from another site, but I am new to soap and web services and am not really sure how to implement it, don't suppose you have a dummies guide or pointers in the right direction? :-)

    Thanks
    Rutter
  • Rutter;16617 said:
    Hi cyberde,
    Just found this mod as I was looking to add tickets/info from another site, but I am new to soap and web services and am not really sure how to implement it, don't suppose you have a dummies guide or pointers in the right direction? :-)

    Thanks
    Rutter
    Hi,
    No I do not have a dummy guide, but I do have some PHP examples on my site to show how easy it is to use this mod.
    Which programming language are you planning to use?

    Cheers
  • Hi cyberde,
    I will be using php to start with.

    I have seen the SilverStripe example you have given.

    If I were to take this code and want to create a sample test page to create a ticket, would I not need to include any of your files etc.

    Regards
    Chris
  • No you just need to install the mod as explained on the page. If you click on ostTicket.open you'll get an example for just PHP (no silverstripe what so ever).

    You do not need to include any files since you will be talking to a SOAP-service (hence the URL which you need when creating the SoapClient()).
Sign In or Register to comment.