VB.NET UWP/WinRT Zendesk: Mark Ticket as Spam and Suspend Requester

Back to Index

Marks a ticket as SPAM and suspends the requestor.

Documentation: https://developer.zendesk.com/rest_api/docs/core/tickets#mark-ticket-as-spam-and-suspend-requester

CURL Command

curl -X PUT https://subdomain.zendesk.com/api/v2/tickets/TICKET_ID/mark_as_spam.json \
  -H "Content-Type: application/json" \
  -d '{}' \
  -H "Content-Type: application/json" \
  -u zendesk_email:zendesk_password

VB.NET UWP/WinRT Example

Dim rest As New Chilkat.Rest
Dim success As Boolean

'  URL: https://subdomain.zendesk.com/api/v2/tickets/TICKET_ID/mark_as_spam.json
Dim bTls As Boolean = True
Dim port As Integer = 443
Dim bAutoReconnect As Boolean = True
success = Await rest.ConnectAsync("subdomain.zendesk.com",port,bTls,bAutoReconnect)
If (success <> True) Then
    Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If


rest.SetAuthBasic("zendesk_email","zendesk_password")

Dim json As New Chilkat.JsonObject

rest.AddHeader("Content-Type","application/json")

Dim sbRequestBody As New Chilkat.StringBuilder
json.EmitSb(sbRequestBody)
Dim sbResponseBody As New Chilkat.StringBuilder
success = Await rest.FullRequestSbAsync("PUT","/api/v2/tickets/TICKET_ID/mark_as_spam.json",sbRequestBody,sbResponseBody)
If (success <> True) Then
    Debug.WriteLine(rest.LastErrorText)
    Exit Sub
End If

Dim respStatusCode As Integer = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
    Debug.WriteLine("Response Status Code = " & respStatusCode)
    Debug.WriteLine("Response Header:")
    Debug.WriteLine(rest.ResponseHeader)
    Debug.WriteLine("Response Body:")
    Debug.WriteLine(sbResponseBody.GetAsString())
    Exit Sub
End If