Error 422 when creating a ticket in Zendesk

I am developing an application in ASP.NET MVC5 using Zendesk_v2 (loaded using the nuget package). I have administrator rights for the easynext.zendesk.com subdomain.

Here is my code for creating a ticket:

private static string requestUri = "https://easynext.zendesk.com/api/v2/tickets.json"; 
private static string _username = "gbalasel@easynext.be"; 
private static string _password = "MYPASSWORD"; 
private static ZendeskApi apiZendesk = new ZendeskApi(requestUri, _username, _password, "");

private void CréerTicketZendesk() { 
  var myTicket = apiZendesk.Tickets.CreateTicket(new Ticket() 
  { 
    Subject = "test ticket", 
    Priority = TicketPriorities.Low 
  });
}

This code is sending me an error 422 Unprocessable Entity.

I also made a test account for the client in Zendesk, and the method works fine, the ticket was created in Zendesk, and I also get it in my email account.

+4
source share
3 answers

, , ; script ( 404), ( 400), ( 415), .

.

+1

422, , . , ZD 422 :

  • , . , .
  • - - . , ZD , . , . , , Zendesk Sandbox System ( , , , , , ..).

POST, , , .

+1

, - .

requester_id json.

json -

{
  "ticket": {   
    "subject": "My printer is on fire!",
    "requester_id": 123,
    "assignee_id": 456,
    "type": "incident",
    "subject": "Help, my printer is on fire!",
    "description": "The fire is very colorful.",
    "priority": "High",
    "status": "open",
    "custom_fields": [
      {
        "id":    111, // custom field ID
        "value": "500.23"
      }
    ]
  }
}

+1

Source: https://habr.com/ru/post/1535060/


All Articles