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

API & XML whit Classic ASP

Hello, 
I would like to interface the version 1.7.7 of osTicket with a webapp already operated through the use of the API. 
Unfortunately, the documentation I've found is not exhaustive. without examples. 
I think the best way for me is to use the APIs provided and XML. 
I do not understand the use of the KEY and how to pass parameters through XML and Classic ASP. 
Is there anyone who has managed to do to open a new ticket with the API and Classic ASP?

Comments

  • Sorry I haven't looked at or touched ASP since... well circa 98...
  • ok, ASP is old but more than enough to carry the majority of applications. send a request in xml should not be impossible, or not?
  • I was trying to say that I have no idea, because I haven't played with that technology in a really long time. I would think that it should be possible, but I don't have the foggiest idea how to do it.
  • I'm sorry, there is not the impression I wanted to give, I missed the sense of the phrase. I want to say that since there are APIs osTicket it seems strange that it is not happened to anyone else ASP to interface with osTicket. I do not speak English well .. ;-)
  • edited April 2014
    I tried this, but the result is always: Error 500 :-(
  • I tried this, but the result is always: Error 500 :-(
    tt.txt
    1K
  • Try the attached...
  • Trying again to add the attachment...
    osticket_asp.txt
    1K
  • It looks like you're posting the request wrong, it should be the body of the request as shown below.

    ' post the XML to the ticket system....
    Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    objXMLHTTP.Open "POST", TicketURL, false
    objXMLHTTP.setRequestHeader "X-API-Key", APIKey
    objXMLHTTP.setRequestHeader "Content-Type", "text/xml"
    objXMLHTTP.Send msgXML
    result=objXMLHTTP.responseText
    Set objXMLHTTP = Nothing

    Cheers


  • thanks guys!
    try tomorrow and I can tell you the results.
  • Hi Peter

    You are correct, I was re-writing the code on the fly...
  • hello guys .... 
    With your script no longer receiving error from the server.
    The ticket is not yet open. and does not receive the message from the XML result = objXMLHTTP.responseText is null or empty. What should I watch?
  • Check your api key and IP address, the IP address will most likely be the root IP address of the web server not the IP of your website.
  • If you go log into osticket admin you should be able to view the logs, which will tell you why it failed.
  • Unfortunately when I launch the page NewTT.asp with the code written by you not receive any feedback. the API code is correct and the IP address is the public server where the page NewTT.asp runing. NewTT.asp and os Ticket are on two servers with two different IP addresses. LOG is empty it says only: congratulations you have installed osTicket ..
  • Finally works !!

    Classic ASP & XML Ticket Created !!



    'Decript
    Dim TicketURL

    TicketURL = "http://www.domain.ext/support/api/http.php/tickets.xml"
    APIKey = "ED58F859E0D90A7815D9DDFC43947C8"

    'XML data

    XML_SendData = ("<?xml version=""1.0"" encoding=""UTF-8""?>")&  vbCrLf
    XML_SendData = XML_SendData & ("<ticket alert=""true"" autorespond=""true"" source=""API"">")&  vbCrLf
    XML_SendData = XML_SendData & (" <name>Nome cognome(API)</name>")&  vbCrLf
    XML_SendData = XML_SendData & (" <email>nomecognome@domain.com</email>")&  vbCrLf
    XML_SendData = XML_SendData & (" <subject>Testing API</subject>")&  vbCrLf
    XML_SendData = XML_SendData & (" <phone ext=""123"">318-555-8634</phone>")&  vbCrLf
    XML_SendData = XML_SendData & (" <message>Message content here</message>")&  vbCrLf
    XML_SendData = XML_SendData & (" <ip>000.000.000.000</ip>")&  vbCrLf
    XML_SendData = XML_SendData & ("</ticket>")&  vbCrLf


    Set XMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    xmlHTTP.open "POST", TicketURL, false
    xmlhttp.setRequestHeader "Content-type", "text/HTML; charset=utf-8"
    xmlHttp.setRequestHeader "X-API-Key", APIKey
    xmlHTTP.send XML_SendData
    strStatus = xmlHTTP.Status
    strRetval = xmlHTTP.responseText

    response.write strStatus&"<br>"
    response.write strRetval&"<br>"

    'response.write XML_SendData
    Set xmlHTTP = nothing
    Set xmlDoc = nothing

Sign In or Register to comment.