Skip to content

Misleading description of how to get contents of KB Answer #735

@Erudition

Description

@Erudition

The current API documentation for the Knowledge Base Answers endpoint (/api/v1/knowledge_bases/{ID}/answers/{ID}) is misleading regarding the method for retrieving the actual content (body) of an answer.

The documentation currently states:

If you want to get the content of an answer, add the parameters ?full=1&include_contents=1 to the query URL.

.. tip:: If you want to get the content of an answer, add the parameters

Following this instruction does not result in the answer's body being included in the API response. Based on a review of the Zammad source code, the correct method is different from what is described.

Issue Details:

  1. The full=1 parameter does not appear to be used by this endpoint for including the answer's body content.
  2. The include_contents parameter does not accept a boolean 1. It requires the specific content_id associated with the answer's translation.

Correct Procedure to Retrieve Answer Content:

As our KB only uses English, I've found the content translation IDs correspond with the answer IDs exactly. Therefore, I am able to simply repeat the answer ID as the include_contents value.

To correctly fetch the answer content in general though, a two-step process is required:

  1. First Request: Make a GET request to /api/v1/knowledge_bases/{ID}/answers/{answer_id}. The response will contain an assets object, and within it, a KnowledgeBaseAnswerTranslation object that includes the content_id.
  2. Second Request: Make a second GET request to the same endpoint, but this time, include the content_id retrieved from the first call in the include_contents parameter, like so: ?include_contents={content_id}.

The response to this second request will then correctly include the KnowledgeBaseAnswerTranslationContent object, which contains the body of the answer.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions