Put a template project asset

Writes one image or font (png, jpg, jpeg, gif, webp, or woff2) into the shared project workspace as an unsaved file; Save commits it.

PUT
/v1/templates/{id}/workspace/assets

Writes one image or font (png, jpg, jpeg, gif, webp, or woff2) into the shared project workspace as an unsaved file; Save commits it. The JSON body carries the file as canonical base64 in contentBase64, at most 1 MiB decoded, and the bytes must match the extension in path. replace must be false to add a new file and true to change an existing one.

x-api-key<token>

In: header

Path Parameters

id*string
Match^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

expectedRevision*string
path*string
Match^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?!.*(?:^|\/)\.git(?:\/|$)).{1,1024}$
contentBase64*string
replace*boolean
idempotencyKey*string
Length1 <= length <= 255

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/v1/templates/string/workspace/assets" \  -H "Content-Type: application/json" \  -d '{    "expectedRevision": "string",    "path": "string",    "contentBase64": "string",    "replace": true,    "idempotencyKey": "string"  }'
{  "workspace": {    "projectId": "string",    "organizationId": "string",    "ownerEpoch": 0,    "repositoryName": "string",    "defaultBranch": "string",    "baseCommit": "string",    "remoteHead": "string",    "pendingRemoteHead": "string",    "revision": "string",    "overlay": {      "property1": "string",      "property2": "string"    },    "assetChanges": [      {        "path": "string",        "status": "added"      }    ],    "conflicts": [      {        "path": "string",        "base": "string",        "draft": "string",        "main": "string"      }    ],    "provenance": {      "references": [        {          "kind": "string",          "digest": "string",          "locator": "string"        }      ]    },    "mounts": [      {        "kind": "project",        "root": "/project",        "access": "read-write"      }    ],    "libraryManifestDigest": "string",    "createdAt": "string",    "updatedAt": "string",    "createdBy": {      "userId": "string",      "via": "api"    },    "updatedBy": {      "userId": "string",      "via": "api"    }  },  "files": {    "property1": "string",    "property2": "string"  }}

Related documentation