开始模板构建
/e2b/v2/templates/{templateID}/builds/{buildID}◐ 部分支持请求参数
templateIDstring必填path:
buildIDstring必填path:
fromImagestring可选Image to use as a base for the template build
fromTemplatestring可选Template to use as a base for the template build
fromImageRegistryobject可选展开子字段 (7)
按 type 区分(aws / gcp / registry),此处展开其中一种的形状
typestring必填Type of registry authentication
awsAccessKeyIdstring可选AWS Access Key ID for ECR authentication Required when type is aws. Not used when type is gcp, registry.
awsSecretAccessKeystring可选AWS Secret Access Key for ECR authentication Required when type is aws. Not used when type is gcp, registry.
awsRegionstring可选AWS Region where the ECR registry is located Required when type is aws. Not used when type is gcp, registry.
serviceAccountJsonstring可选Service Account JSON for GCP authentication Required when type is gcp. Not used when type is aws, registry.
usernamestring可选Username to use for the registry Required when type is registry. Not used when type is aws, gcp.
passwordstring可选Password to use for the registry Required when type is registry. Not used when type is aws, gcp.
forceboolean可选Whether the whole build should be forced to run regardless of the cache
stepsarray可选List of steps to execute in the template build
展开子字段 (4)
typestring必填Type of the step
argsarray可选Arguments for the step
filesHashstring可选Hash of the files used in the step
forceboolean可选Whether the step should be forced to run regardless of the cache
startCmdstring可选Start command to execute in the template after the build
readyCmdstring可选Ready check command to execute in the template after the build
返回
202
错误按 E2B 格式返回,参见 错误码
请求示例
curl
curl https://api.deepraxis.com/e2b/v2/templates/sbe_example/builds/sbt_example \
-H "X-API-Key: $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"fromTemplate":"base","steps":[{"type":"RUN","args":["echo template-reference"]}]}'Python
import requests
opts = dict(
api_key="$PRAXIS_API_KEY",
api_url="https://api.deepraxis.com/e2b",
domain="sandbox.praxisusercontent.com",
)
# templateID and buildID come from the preceding create response; replace the example IDs.
resp = requests.request("POST", opts["api_url"] + "/v2/templates/sbe_example/builds/sbt_example",
headers={"X-API-Key": opts["api_key"]},
json={"fromTemplate":"base","steps":[{"type":"RUN","args":["echo template-reference"]}]},
)
print(resp.status_code, resp.text)TypeScript
const opts = {
apiKey: "$PRAXIS_API_KEY",
apiUrl: "https://api.deepraxis.com/e2b",
domain: "sandbox.praxisusercontent.com",
};
// templateID and buildID come from the preceding create response; replace the example IDs.
const resp = await fetch(opts.apiUrl + "/v2/templates/sbe_example/builds/sbt_example", { method: "POST",
headers: { "X-API-Key": opts.apiKey, "Content-Type": "application/json" },
body: JSON.stringify({"fromTemplate":"base","steps":[{"type":"RUN","args":["echo template-reference"]}]}),
});
console.log(resp.status, await resp.text());响应示例 202
{}响应
HTTP 202
The build has started
未声明响应体。