User Manual

Assets - Update asset

Route URL

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

Description

Update an existing asset's file.

This endpoint currently only supports updating `script`, `html`, `css`, `text`, `shader` and `json` type assets.

Unlike other REST API endpoints. The Update Asset endpoint expects data to be sent in multipart/form-data

Example

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

Parameters

branchId: string

The id of the branch
file: file

Data to update asset file with

Response Schema

Status: 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
}

Errors

401

Unauthorized

403

Forbidden

404

Project or Asset not found

429

Too many requests

Rate Limiting

This route uses a strict rate limit.

This site is translated by the community. If you want to get involved visit this page