Update work
Code Mode: praxis.media.libraries.works.update
HTTP: PATCH /media/v1/libraries/{library_id}/works/{work_id}
Change a work. body replaces the whole body and is checked like a new one; series replaces the series and null clears it; custom is a JSON Merge Patch (RFC 7396), so a script writing back its published link and numbers sends only its own keys and never erases keys another script wrote, and null removes a key. Send if_revision with the revision you read to apply the change only if nobody changed the work since; otherwise the answer is 409 REVISION_CONFLICT. Example: PATCH /media/v1/libraries/default/works/<work id> with {“custom”:{“published_url”:“https://…”,“stats”:{“likes”:120}}}.
签名
praxis.media.libraries.works.update(args:{path:{library_id:string;work_id:string};body:{/** A whole new body for the same kind; it replaces the old one and is checked like a new one. */ 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};/** A new series, or null to clear it. */ series?:string|null;/** A JSON Merge Patch (RFC 7396): keys you send are set, keys set to null are removed, keys you leave out are kept. */ custom?:{[key:string]:unknown};/** Apply the change only if the work is still at this revision; otherwise the answer is 409 REVISION_CONFLICT with the current revision. */ if_revision?:number}}):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_id | path | string | 是 | Library ID returned by creation. |
| work_id | path | string | 是 | Work id (wrk_…) returned by creation or listing. |
请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 200 | application/json | Successful response. |
| 400 | application/json | A selector, cursor, limit or other parameter is invalid; correct the reported field before retrying. |
| 402 | application/json | Request failed; see the error code reference. |
| 403 | application/json | This credential has read-only access to the library; use a write-capable binding for mutations. |
| 404 | application/json | The library or asset is missing, deleted or belongs to another tenant; verify its identifier and owner. |
| 409 | application/json | Request failed; see the error code reference. |
| 413 | application/json | The file exceeds an input limit; provide a smaller source file. |
| 415 | application/json | This media format is unsupported; provide a supported format. |
| 422 | application/json | Request failed; see the error code reference. |
| 429 | application/json | A rate limit was reached; wait before retrying. |
| 501 | application/json | The requested operation is unsupported; choose a supported method. |
| 502 | application/json | Request failed; see the error code reference. |
| 503 | application/json | Historical projections are still being initialized, or library storage is temporarily unavailable; retry shortly and check failureSummary counts_complete. |