[SOLVED] Knowledge base api - create article

Infos:

  • Used Zammad version: Latest
  • Used Zammad installation type: Package
  • Operating system: Debian

Expected behavior:

  • Upon using HTTP PUT request to create a KB article it receive no error

Actual behavior:

  • Error received:
{
    "error": "Translations kb locale must exist",
    "error_human": "Translations kb locale must exist"
}

Steps to reproduce the behavior:

curl --location --request POST 'https://____/api/v1/knowledge_bases/1/answers' \
--header 'Authorization: Token token=_____' \
--header 'Content-Type: application/json' \
--data-raw '{"category_id":"1","translations_attributes":[{"title":"test05 api", "id":"","content_attributes":{"body":"test05 api body"}}]}'```

@Filippoc it needs kb_locale_id attribute inside of translations_attributes. That locale has to be created on the server beforehand. Even if KB is not translated, there’s still a single translation :slight_smile:

2 Likes

It Worked!!
I’ve been trying to have a better understanding of these undocumented API looking at the routing file (zammad/knowledge_base.rb at c1d467aa3de322f2c35ada1d32590f2b1b2397b9 · zammad/zammad · GitHub) but without much success.
Thanks again!

If i’ll have time to work on a super simple documentation which is the better way to distribute it to the community?

Hey,

contributions to the documentation would help most of the Zammad users in my opinion ( I mean instead of single fractures all over the internet ).

You can find ideas on how we visually built the API docs here:
https://docs.zammad.org/en/latest/api/user.html

Documentation source wise, the relevant files can be found here:

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.