跳转到内容
EN

Get work

Code Mode: praxis.media.libraries.works.retrieve

HTTP: GET /media/v1/libraries/{library_id}/works/{work_id}

Read one work with its body, custom fields, revision and missing (asset ids deleted since; the body keeps them in place). Add expand=assets to receive every referenced asset’s type, short-lived url, thumbnail_url and size in the same answer, which is what a publish script needs to send the work out. Use work_id from creation or listing.

签名

praxis.media.libraries.works.retrieve(args:{path:{library_id:string;work_id:string};query?:{expand?:string}}):Promise<{/** Always work. */ object:"work";/** Work id (wrk_…). */ id:string;/** Library the work belongs to. */ library_id:string;/** The work’s kind. */ kind:"gallery"|"article"|"product_listing"|"blocks";/** The title, copied from body.title. */ title:string;/** Groups the platform versions of one story; null when unset. */ series:string|null;/** The kind’s body as stored. */ body:{/** Title, 1 to 100 characters. */ title:string;/** Body text, at most 10000 characters. */ text?:string;/** Topics without the # sign, at most 30 of up to 40 characters. */ topics?:Array<string>;/** Optional cover: an image or sticker asset of this library; without it the first picture is the cover. */ cover?:string;/** Pictures, videos and text segments in order, 1 to 100 entries with at least one asset; each asset appears once. */ items:Array<{/** An image, sticker or video asset of this library; its position in items is its position in the gallery. */ asset_id:string;/** Optional caption for this picture, at most 1000 characters. */ caption?:string}|{/** A text segment shown between pictures, at most 1000 characters. */ text:string}>;/** Display style; defaults to xiaohongshu in the Console. */ style?:"xiaohongshu"|"wechat_mp"|"jike"|"generic"}|{/** Title, 1 to 200 characters. */ title:string;/** Optional summary or digest, at most 500 characters. */ summary?:string;/** Optional author name, at most 60 characters. */ author?:string;/** The article in Markdown, 1 to 100000 characters; every asset:<asset_id> image must be an image or sticker of this library. */ body:string;/** Optional cover: an image or sticker asset of this library. */ cover?:string;/** Display style; defaults to wechat_mp in the Console. */ style?:"xiaohongshu"|"wechat_mp"|"jike"|"generic"}|{/** Listing title, 1 to 200 characters. */ title:string;/** Selling points in order, at most 10 of up to 100 characters. */ selling_points?:Array<string>;/** Parameter rows in order, at most 50. */ attributes?:Array<{/** Parameter name such as 容量, at most 40 characters. */ name:string;/** Parameter value such as 500ml, at most 200 characters. */ value:string}>;/** Main images in order, 1 to 20 image or sticker assets of this library. */ main:Array<string>;/** Detail images in order, at most 100 image or sticker assets of this library. */ detail?:Array<string>;/** SKUs in order, at most 200. */ skus?:Array<{/** The SKU’s value on each spec axis, such as {"颜色":"白"}; 1 to 5 axes; the keys are kept as written. */ spec:{[key:string]:string};/** Optional picture of this SKU: an image or sticker asset of this library. */ asset_id?:string}>;/** Optional product element (material_type product) this listing shows. */ product?:string;/** Display style; defaults to generic in the Console. */ style?:"xiaohongshu"|"wechat_mp"|"jike"|"generic"}|{/** The work’s title, 1 to 200 characters, written explicitly as in the other kinds; lists and sorting use it. */ title:string;/** Optional Editor.js save time in milliseconds, kept as sent. */ time?:number;/** The blocks in order, 1 to 500. */ blocks:Array<{/** Block id, 1–64 letters, digits, _ or -, unique in the body. */ id:string;/** The official Editor.js block type. */ type:"paragraph"|"header"|"list"|"quote"|"delimiter"|"image"|"table"|"checklist"|"warning"|"embed";/** The block’s data in that type’s Editor.js shape. */ data:{[key:string]:unknown}}>;/** Optional Editor.js version string, kept as sent. */ version?:string};/** Caller data such as source, published links and numbers; changed with a JSON Merge Patch. */ custom:{[key:string]:unknown};/** Asset ids the body names that have been deleted since; the body keeps them in place and the Console draws a placeholder there. */ missing:Array<string>;/** Bumped by every change; send it back as if_revision to update only an unchanged work. */ revision:number;/** Who created the work: human:<user id>, agent:<agent id> or system. */ created_by:string;/** When the work was created. */ created_at:string;/** When the work last changed. */ updated_at:string;/** Only with expand=assets: every live referenced asset by id, with its URLs and size. */ assets?:{[key:string]:{/** The asset’s material type, such as image or video. */ type:"image"|"video"|"audio"|"voice"|"sticker"|"font"|"text_style"|"text_template"|"animation_preset"|"lut"|"transition_map"|"character"|"product"|"scene"|"brand"|"file";/** Short-lived delivery URL of the asset. */ url:string;/** Short-lived URL of a small picture: the poster of a video, otherwise the asset itself. */ thumbnail_url:string;/** Width in pixels when known. */ width?:number;/** Height in pixels when known. */ height?:number;/** The asset’s display name. */ display_name:string}}}>;

参数

名称位置类型必填说明
library_idpathstring是Library ID returned by creation.
work_idpathstring是Work id (wrk_…) returned by creation or listing.
expandquerystring否assets returns every referenced asset with its URLs and size.

响应

状态码内容类型说明
200application/jsonSuccessful response.
400application/jsonA selector, cursor, limit or other parameter is invalid; correct the reported field before retrying.
402application/jsonRequest failed; see the error code reference.
403application/jsonThis credential has read-only access to the library; use a write-capable binding for mutations.
404application/jsonThe library or asset is missing, deleted or belongs to another tenant; verify its identifier and owner.
409application/jsonRequest failed; see the error code reference.
413application/jsonThe file exceeds an input limit; provide a smaller source file.
415application/jsonThis media format is unsupported; provide a supported format.
422application/jsonRequest failed; see the error code reference.
429application/jsonA rate limit was reached; wait before retrying.
501application/jsonThe requested operation is unsupported; choose a supported method.
502application/jsonRequest failed; see the error code reference.
503application/jsonHistorical projections are still being initialized, or library storage is temporarily unavailable; retry shortly and check failureSummary counts_complete.