Error in validation/error message for creating translations for categories and sections | The place for Zendesk users to come together and share
Skip to main content
Question

Error in validation/error message for creating translations for categories and sections

  • July 24, 2023
  • 3 replies
  • 5 views

There is an error in validation for creating translations for categories and sections. The returned error is "Name cannot be blank" however what it is actually validating on is "Title."

for sectionLocale in missingSectionTranslations:
#create a new section for each translation
payload["translation"]["locale"] = sectionLocale
payload["translation"]["title"] = payload["translation"]["name"]
response = requests.request(
"POST",
c.URL+"sections/"+str(section["id"])+"/translations",
json=payload,
auth=(c.USER,c.PASSWORD),
headers=c.HEADERS
)

3 replies

Hi Ross,
 
Does the parent category of this new section translation have a translation for that locale as well?  So for example if you're trying to add an en-au translation to a section, does that section's parent category have an en-au translation?

  • Author
  • August 2, 2023

Yes, the issue also occurred with categories. The solution to get a 200 was to simply add a "title" key to the json. Once I did that it passed the name:cannot be blank validation.

Either the validation error returned on a 400 needs to be updated to specify title instead of name, or there is unneeded validation looking for title when it is not required. I believe it may be the latter as "title" is not listed as a property on category or section.

payload["translation"]["title"] = payload["translation"]["name"]

  • Newcomer
  • April 21, 2026

any resolution on this ? I’m also trying to automate creating a category and its translations at the same time

19:18:45.890 [default-eventLoopGroup-1-2] DEBUG i.m.h.client.netty.DefaultHttpClient - Sending HTTP POST to https://d3v-peanutbutterunicorn.zendesk.com/api/v2/help_center/categories
19:18:45.890 [default-eventLoopGroup-1-2] TRACE i.m.h.client.netty.DefaultHttpClient - Accept: application/json
19:18:45.890 [default-eventLoopGroup-1-2] TRACE i.m.h.client.netty.DefaultHttpClient - Authorization: *MASKED*
19:18:45.890 [default-eventLoopGroup-1-2] TRACE i.m.h.client.netty.DefaultHttpClient - host: d3v-peanutbutterunicorn.zendesk.com
19:18:45.890 [default-eventLoopGroup-1-2] TRACE i.m.h.client.netty.DefaultHttpClient - Content-Type: application/json
19:18:45.890 [default-eventLoopGroup-1-2] TRACE i.m.h.client.netty.DefaultHttpClient - Request Body
19:18:45.890 [default-eventLoopGroup-1-2] TRACE i.m.h.client.netty.DefaultHttpClient - ----
19:18:45.890 [default-eventLoopGroup-1-2] TRACE i.m.h.client.netty.DefaultHttpClient - {"category":{"name":"cockroach","position":0,"source_locale":"en-us","translations":[{"locale":"fr","title":"It's already mutated into human form! Shoot it!"},{"locale":"en-us","title":"We can’t change what's done, we can only move on."}]}}

I’m essentially trying to recreate this snippet from the api docs:
 

# You can also specify multiple translations for the new category:
curl https://{subdomain}.zendesk.com/api/v2/help_center/categories \ -d '{"category": {"position": 2, "translations": \ [{"locale": "en-us", "title": "Super Hero Tricks", \ "body": "This category contains a collection of Super Hero tricks"}, \ {"locale": "fr", "title": "Trucs Super Heros", \ "body": "Cette categorie contient une collection de trucs super heros"}]}}' \ -v -u {email_address}/token:{api_token} -X POST -H "Content-Type: application/json"