メインコンテンツまでスキップ

アセット - Update asset

ルートURL​

PUT https://playcanvas.com/api/assets/:assetId

説明​

既存のアセットのファイルを更新します。

注記

現在、このエンドポイントは script、html、css、text、shader、json のタイプのアセットの更新のみをサポートしています。

他のREST APIエンドポイントとは異なり、アップデートアセットエンドポイントはデータを multipart/form-data で送信することが必要です。

例​

curl -H "Authorization: Bearer {accessToken}" -X PUT -F 'pow2={pow2}' -F 'file=@./script.js' "https://playcanvas.com/api/assets/{assetId}"

パラメーター​

名前タイプRequired説明
assetIdnumber✔️The id of the asset.
filefile✔️Data to update asset file with.
pow2booleanOnly used for textures and defaults to false. Resize the texture to power of two dimensions (true / false).

レスポンススキーマ​

ステータス:200
{
"id": int,
"modifiedAt": date,
"createdAt": date,
"state": "ready" | "processing" | "error",
"name": string,
"type": string,
"scope":{
"type": string,
"id": int
},
"source": bool,
"sourceId": bool,
"tags": list of strings,
"preload": bool,
"data": {
... asset data
},
"file": {
"hash": string,
"filename": string,
"size": int,
"url": string
},
"parent": int
}

エラー​

コード説明
401Unauthorized
403Forbidden
404Project or Asset not found
429Too many requests

レート制限​

This route uses an assets rate limit.