locked
Create ticket with Tags using ZendeskApi_v2 RRS feed

  • Question

  • User945338570 posted

    hi ,

    I am new to zendesk and want to create tickets including Tags too in zendesk using ZendeskApi_v2.

    At present I am coding this way but getting 400 bad request error:

    Code:

      Public Function GenrateTicket1(ByVal Subject As String, ByVal Name As String, ByVal Email As String, ByVal Order As String, ByVal Description As String) As String
            Dim content = ""
            '  If SqlHelper.of_FetchKey("zendesk_enable") = 1 Then
    
            'Try
            Dim client = New RestSharp.RestClient(requestUri)
            client.Authenticator = New HttpBasicAuthenticator(username, password)
            Dim request = New RestRequest("/api/v2/tickets.json", Method.POST)
            request.AddHeader("Accept", "application/json")
            request.Parameters.Clear()
            'Dim createTicket As New NewTicket()
            Dim api As ZendeskApi = New ZendeskApi(requestUri, username, password)
    
            Dim t1 = api.Tickets.CreateTicket(New Ticket With {.Subject = Subject + ": " + Order, .Status = "open", .Tags = {"dss"}, .Type = "incident", .Priority = "high", .Requester = New Requester With {.Email = Email}, .Description = "Test Description", .Comment = New Comment With {.Body = "this is test comment"}})
    
            'request.RequestFormat = RestSharp.DataFormat.Json
            'request.AddBody(t1)
            'Dim response As IRestResponse = client.Execute(request)
            'content = response.Content
    
            ' Catch ex As System.Exception
            'send_error_mail()
            'content = ex.Message
            'End Try
            ' End If
            Return content
        End Function

    On Page Load I have called this function:

    Dim str As String = ""
                str = GenrateTicket1("test", "myname", "test@gmail.com", "1111", "This is a test description with tags")
                Response.Write(str)

    Monday, January 5, 2015 2:27 AM

All replies

  • User509211905 posted

    Hi there,

    Check out your previous post, I reply an answer to it. 

    http://forums.asp.net/t/2027873.aspx?Convert+this+Curl+Code+to+Vb+net+or+C+

    Thursday, January 8, 2015 1:03 PM