Repository navigation
Align Knowledge endpoints in 2.17 and Preview with API responses - #762
Conversation
markdennis22
left a comment
There was a problem hiding this comment.
Thanks for this, Cathal.
I compared both specs before and after the change, checked every reference resolves, ran fern check (0 errors and 317 warnings, the same as main), and checked the new statements against what the API returns.
A few questions:
-
tag.applied_at/applied_byafter a removal: The new text says both arenull"when the tag has just been removed". That's true when you detach a tag from an article, internal article or content snippet. Detaching from a contact, conversation or ticket returns the removed tag's originalapplied_atandapplied_by, which is what the detachTagFromContact, detachTagFromConversation and detachTagFromTicket examples already show. Could thenullcase name the content operations only? The "returned when" list also leaves out listing a contact's tags and external pages. -
Detach
admin_id: The description says it's "the teammate to attribute the removal to", but the removal isn't recorded against anyone. The id is only checked, and an unknown teammate returns 404admin_not_found. Should detachTagFromInternalArticle and detachTagFromContentSnippet say that instead? -
Folder list null keys: The reference showed
parent_folder_id: nullon list items. The API leaves outdescription,emojiandparent_folder_idfrom list items when they're null, but includes them asnullwhen you retrieve, create or update a folder. Should the list example keep the null keys until the list behaves the same way, or describe the omission? -
List internal articles
pages: With the newpageandper_pageparams, the list response echoes them back as strings, for example"per_page": "1". Search returns integers. Shouldpages.pageandpages.per_pagestayinteger, or say they come back as strings when you send them? -
Content search 401: Content search keeps the generic
Unauthorizedresponse in both versions, while bulk actions and the snippet operations now name their scope and show thetoken_unauthorizedexample. A token withoutread_contentgets that same 401token_unauthorized. Should content search name it too? -
Undocumented internal article errors:
- Create and update also return 400
data_invalidwhenaudience_idsisn't an array of integers. - They return 422
parameter_invalid" must be a boolean (true or false)" for a non-booleanai_*_availability. - Update also returns 404 "Admin with ID X not found" for an unknown
author_id, which create already lists.
Should these be listed?
- Create and update also return 400
-
Shape changes: In both versions, bulk actions loses its 403, create internal article's 400 loses its body, and content search
pages.next/prevlosenullable. Preview content search also loses its 403. The Preview SDK gains optionalpageandper_page(list and search internal articles),admin_id(both detach operations), andjson_blocksandlocale(create and update internal article). Could the PR body call these out? -
Merge conflicts: This conflicts with main (#747) on the
tag.applied_atandapplied_bydescriptions in both specs. It also conflicts with #759 onapplied_byin 2.17. -
Example details (small):
- The snippet 400 examples and the snippet 422 mutual-exclusion example leave out
request_id, but those responses include one. - The 2.17 content search
nextandprevexamples leave outper_page, which the links always include.
- The snippet 400 examples and the snippet 422 mutual-exclusion example leave out
Holding approval until 1–6 are settled and the PR is rebased.
~ Automated via Claude
Correct the internal article, folder, content snippet, content search and bulk action operations so the spec matches what the API returns. - Add the OAuth scope line to the operations that lacked one - Document the real error responses (401 token scope, 400 and 422 validation, 404 unknown teammate or folder, live-experiment conflict) and fix examples whose codes or messages could not be produced - Document page and per_page on list and search internal articles, the optional admin_id on tag removal, and the locale and json_blocks request fields - Note that omitted keys (folder list fields, content search next and prev) are absent rather than null - Regenerate the internal article update and search examples with every returned field, and drop the heading the markdown output never emits - Add tags to the internal article list item (2.17) and widen the tag schema description to cover internal articles and content snippets Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Narrow the tag applied_at/applied_by null case to content removals, say that the detach admin_id is checked but not recorded, document the missing internal article errors, add the content search 401 scope example, note values returned as strings, and add request_id and per_page to a few examples. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
c49856b to
abbfca5
Compare
|
Thanks Mark. Rebased onto main and pushed. Taking your points in order:
I couldn't run |
Why?
The Knowledge operations (internal articles, folders, content snippets, content search and bulk actions) document errors the API never returns, leave out ones it does, and don't say which OAuth scope each one needs. Several examples also show fields or values the API doesn't send, so integrators build against the wrong contract.
How?
Each documented behaviour was checked against what the API returns, and the scopes, error responses, parameters and examples were corrected in both the 2.17 and Preview specs. No version after 2.17 changes these operations, so both get the same edits.
Risks
The API doesn't change, but these changes affect generated types: the Preview SDK when it's next regenerated, and any client generated from 2.17 once it's published.
token_unauthorized, never a 403pages.nextandpages.prevare no longernullablenullnullpageandper_page(list and search internal articles),admin_id(detach a tag from an internal article or content snippet), andjson_blocksandlocale(create and update internal article)Behaviour that looks like a bug, documented as it is
description,emojiandparent_folder_idare left out of list items. Retrieve, create and update return them asnullpages.pageandpages.per_pagecome back as strings when you send themjson_blockscomes back as a JSON-encoded string, not an arrayadmin_idis checked, and an unknown teammate is a 404, but the removal isn't recorded against themauthor_idis a 404 with codeparameter_invalidrequest_idisnullGenerated with Claude Code