-
Notifications
You must be signed in to change notification settings - Fork 127
Description
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=1to 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:
- The
full=1parameter does not appear to be used by this endpoint for including the answer's body content. - The
include_contentsparameter does not accept a boolean1. It requires the specificcontent_idassociated 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:
- First Request: Make a GET request to
/api/v1/knowledge_bases/{ID}/answers/{answer_id}. The response will contain anassetsobject, and within it, aKnowledgeBaseAnswerTranslationobject that includes thecontent_id. - Second Request: Make a second GET request to the same endpoint, but this time, include the
content_idretrieved from the first call in theinclude_contentsparameter, 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.