Requests API: Country: cannot be blank / Email: cannot be blank | Community
Skip to main content

Requests API: Country: cannot be blank / Email: cannot be blank

  • February 15, 2022
  • 2 replies
  • 0 views

I've set my account to allow anonymous Tickets to be created via https://clevertouch.zendesk.com/api/v2/requests.json.

I making an un-authenticated call in PostMan to pass this simple test:

{"request": {"subject": "Test Subject", "comment": {"body": "Test Description"}}}
 
I always receive a 422 Error with the following details:
 
{
    "error": "RecordInvalid",
    "description": "Record validation errors",
    "details": {
        "base": [
            {
                "description": "Country: cannot be blank",
                "error": "BlankValue",
                "field_key": 360010161958
            }
        ],
        "email": [
            {
                "description": "Email: cannot be blank",
                "error": "BlankValue"
            }
        ]
    }
}
 
Unless I use an Agents authentication with an API Token, but this is not what is required for our use-case.
 
Can anyone guide me towards a resolution?
 
Thanks,
 
Matt

 

2 replies

  • Author
  • February 15, 2022

OK, I've worked out we have a Custom field on Tickets called "Country" (I didn't set this up) that is *Required to submit a request - and if I turn that off the first error goes away - and I've worked out how to pass the Custom Field with it's Tag for Country:

{"request": {"subject": "Test Subject","custom_fields": [{ "id": 360010161958, "value": "united_kingdom"},{"id": 360004990877, "value": "serialtest101"}], "comment": {"body": "Test Description"}}}
 
But what is "Email: cannot be blank" realting to and how do I pass it over?

  • Author
  • February 15, 2022

In case this helps anyone else, "Email: cannot be blank" is a more standard error, and I could find help on this one.  In brief, pass over a Requester object:

{"request": {"requester": {"name": "Test Customer","email":"test@test.com"},"subject": "Test Subject","custom_fields": [{ "id": 360010161958, "value": "united_kingdom"},{"id": 360004990877, "value": "serialtest101"}], "comment": {"body": "Test Description"}}}