Forum Discussion
Stewart11
11 years agoNew Member
Hi Hitesh,
I was playing around with the ASP.NET for a while but found it very clunky and slow but that might have been the way I was using it...
What I was trying to do was create a report (in GTA) which had the required details in it and then show it up in a dashboard on our service desk wall with other dashboards (reports)...
I created a "function" to count the number of open tickets within a department.
Public Shared Function GetCountFromReport(ByVal reportnumber As String) As String
' Build URL with report number at the end
Dim wURL = "https://deskapi.gotoassist.com/v1/inc...=" & reportnumber
Dim mRequest As HttpWebRequest = WebRequest.Create(wURL)
mRequest.ContentType = "application/json"
'API code. The "x:" must before the API code.
Dim usernamePassword As String = "x:APICODE"
Dim enc As New UTF8Encoding()
mRequest.Headers.Add("Authorization", Convert.ToBase64String(enc.GetBytes(usernamePassword)))
Dim wResponse As HttpWebResponse
Try
wResponse = mRequest.GetResponse()
Dim sResponse As String = ""
Using srRead As New StreamReader(wResponse.GetResponseStream())
sResponse = srRead.ReadToEnd()
End Using
Dim x() As String = Split(sResponse, ",")
Dim y() As String = Split(x(2), ":")
Return y(2)
Catch ex As Exception
Return ex.Message.ToString
End Try
End Function
Where it shows APICODE, replace with your API as found in the GTA.
I would call that function via:
Dim AugTC As Integer = Convert.ToInt32(clReport.GetCountFromReport(REPORTNUMBER))
Replace REPORTNUMBER with the report number of GTA.
The biggest problem for me was getting the connection to GTA working. Once I had that sorted then the API's as listed in Beetil started to make sense. www.beetil.com/api but it looks like the site is shutdown.
It is written in VB.net but should be easy to translate to C#.
Hope that helps...
Stewy
I was playing around with the ASP.NET for a while but found it very clunky and slow but that might have been the way I was using it...
What I was trying to do was create a report (in GTA) which had the required details in it and then show it up in a dashboard on our service desk wall with other dashboards (reports)...
I created a "function" to count the number of open tickets within a department.
Public Shared Function GetCountFromReport(ByVal reportnumber As String) As String
' Build URL with report number at the end
Dim wURL = "https://deskapi.gotoassist.com/v1/inc...=" & reportnumber
Dim mRequest As HttpWebRequest = WebRequest.Create(wURL)
mRequest.ContentType = "application/json"
'API code. The "x:" must before the API code.
Dim usernamePassword As String = "x:APICODE"
Dim enc As New UTF8Encoding()
mRequest.Headers.Add("Authorization", Convert.ToBase64String(enc.GetBytes(usernamePassword)))
Dim wResponse As HttpWebResponse
Try
wResponse = mRequest.GetResponse()
Dim sResponse As String = ""
Using srRead As New StreamReader(wResponse.GetResponseStream())
sResponse = srRead.ReadToEnd()
End Using
Dim x() As String = Split(sResponse, ",")
Dim y() As String = Split(x(2), ":")
Return y(2)
Catch ex As Exception
Return ex.Message.ToString
End Try
End Function
Where it shows APICODE, replace with your API as found in the GTA.
I would call that function via:
Dim AugTC As Integer = Convert.ToInt32(clReport.GetCountFromReport(REPORTNUMBER))
Replace REPORTNUMBER with the report number of GTA.
The biggest problem for me was getting the connection to GTA working. Once I had that sorted then the API's as listed in Beetil started to make sense. www.beetil.com/api but it looks like the site is shutdown.
It is written in VB.net but should be easy to translate to C#.
Hope that helps...
Stewy