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

Need help on the error of 403 forbidden

I have error showing when I try to run the code its showing the API key all fine but cannot get linked to the URL please help me.
Im adding the code
Imports System
Imports System.Collections.Generic
Imports System.Net
Imports System.Configuration
Imports Newtonsoft.Json

Public Class RFTJsonTicket



    Function ReadSetting(key As String) As String
        Try
            Dim appSettings = ConfigurationManager.AppSettings
            Dim result As String = appSettings(key)
            If IsNothing(result) Then
                result = "Not found"
            End If
            Return result
        Catch e As ConfigurationErrorsException
            Console.WriteLine("Error reading app settings")
        End Try
    End Function
    Public Sub TracingTest(ByVal fileName As String)
        My.Application.Log.WriteEntry("Entering TracingTest with argument " & fileName & ".")
        My.Application.Log.WriteEntry("Exiting TracingTest with argument " & fileName & ".")
    End Sub
    Public Function createJson() As Integer
        Dim payload As New Dictionary(Of String, Object)()
        payload.Add("name", "Angry User")
        payload.Add("email", "api@osticket.com")
        payload.Add("phone", "3185558634X123")
        payload.Add("subject", "Testing API")
        payload.Add("ip", "143.95.243.240")
        payload.Add("message", "Message HERE")
        payload.Add("topicId", "1")


        Dim Client As New WebClient
        Client.Headers.Add("X-API-Key", ReadSetting("API"))
        Client.Headers.Add("Expect", String.Empty)
        Client.Headers.Add("User-Agent", "MyosTicket Client")

        Dim strgJson As String = JsonConvert.SerializeObject(payload)
        Client.UploadString("http://onlineticketcentral.com/api/ost-api.php", "POST", strgJson)
        Return 0
    End Function
End Class

Comments

  • edited July 2016
    403 forbidden is not an osTicket error code, its a HTTP status code which means that you do not have permission to access the page or resource.  You would need to consult your webserver software's error log to see what file, and any other details pertaining to this error.  This is not really something that we can assist you with much beyond telling you its permissions related.

    As a side note I'm not sure what /api/ost-api.php is... because that is not an osTicket file.
  • FYI: From my end, I'm getting a 400 Bad Request, not a 403 Forbidden. So, maybe you've fixed it? 
Sign In or Register to comment.