Skip to Content

Stage a historical template project tree

Stage a historical template project tree. Request: POST /v1/templates/{id}/workspace/restore. Scope: templates:create.

POST
/v1/templates/{id}/workspace/restore

Builds the template entry before atomically staging a reachable historical commit and its emitted source; a later Save appends a new commit without rewriting branch history.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

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

Header Parameters

idempotency-key*string
Length1 <= length <= 255

Request Body

application/json
  1. body
expectedRevision*string
commit*string
Match^[a-f0-9]{40}$

Response Body

Success

application/json
  1. response
view*
source*
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.templates.restoreWorkspace({
  "id": "example",
  "expectedRevision": "example",
  "commit": "example"
});
Example Response
{
  "view": {
    "workspace": {
      "projectId": "string",
      "organizationId": "string",
      "ownerEpoch": 0,
      "repositoryName": "string",
      "defaultBranch": "string",
      "baseCommit": "string",
      "remoteHead": "string",
      "pendingRemoteHead": "string",
      "revision": "string",
      "overlay": {
        "property1": "string",
        "property2": "string"
      },
      "assetDigest": "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"
    }
  },
  "source": {
    "digest": "string",
    "content": "string"
  }
}

Related documentation