跳转到内容
EN

Export the draft as Markdown or plain text

Code Mode: praxis.studio.works.drafts.retrieveExport

HTTP: GET /studio/v1/works/{work}/drafts/{draft}/export

Read the whole draft as one document in Markdown or plain text, returned synchronously in the answer. This is the quick path for a person who wants the text now; a file in a platform format, a card image or a docx comes from creating a rendition instead. Ask for text rather than markdown when the reader should not see block anchors or heading syntax.

签名

praxis.studio.works.drafts.retrieveExport(args:{path:{/** e.g. "wu-gang" */ work:string;/** e.g. "novel" */ draft:string};query:{/** e.g. "markdown" */ format:"markdown"|"text"}}):Promise<{/** The draft text: Markdown with headings, list markers and block anchors, or plain text with the markup removed. e.g. "第十二章 排字房\\n\\n排字房的铅字盘上,压着一张通缉令。" */ content:string;/** Content revision of the draft this text was produced from, so a caller can tell whether it exported the latest text. e.g. 96 */ revision:number}>;

参数

名称位置类型必填说明
workpathstring是The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value.
draftpathstring是Draft being addressed, either its in-work key such as novel or its drf_ identifier; a key renamed earlier still resolves through its previous value.
formatquery“markdown” | “text”是Format to render the draft in: markdown keeps headings, list markers and block anchors, and text drops the markup entirely.

响应

状态码内容类型说明
200application/jsonThe controller text together with the draft revision it was produced from.
400application/jsonINVALID_PARAMS means a field is missing, malformed or not allowed for this resource; correct the named field and repeat the call.
401application/jsonThe API key is missing, invalid or carries no organization; send a valid organization key in the Authorization header.
404application/jsonWORK_NOT_FOUND or DRAFT_NOT_FOUND means the work or the draft inside it is not reachable; use the slug and the draft key from the lists, or resolve a loose name first. A draft renamed earlier still answers under its previous key.
500application/jsonINTERNAL means the request could not complete; re-read the resource before retrying a write, because the write may already have landed.