创建目录
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
POST
/sandbox/v1/sandboxes/{sandbox_id}/files:makeDir● 支持请求参数
sandbox_idstring必填path: Sandbox ID returned by sandboxes.create or sandboxes.list.
pathstring必填query: File or directory path inside the sandbox; relative paths use the user's home directory.
返回
200
错误按 E2B 格式返回,参见 错误码
请求示例
curl
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
curl -X POST "https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/files:makeDir?path=/tmp/docs-files" \
-H "X-API-Key: $PRAXIS_API_KEY"Python
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
import requests
api_key = "$PRAXIS_API_KEY"
# Call /sandbox/v1 directly over HTTP.
resp = requests.post(
"https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/files:makeDir?path=/tmp/docs-files",
headers={"X-API-Key": api_key},
)
print(resp.status_code, resp.text)TypeScript
// 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
const apiKey = "$PRAXIS_API_KEY";
// Call /sandbox/v1 directly over HTTP.
const resp = await fetch(`https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/files:makeDir?path=/tmp/docs-files`, {
method: "POST",
headers: { "X-API-Key": apiKey },
});
console.log(resp.status, await resp.text());响应示例 200
true响应
HTTP 200
Operation completed
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| $ | boolean | True if created; false if the path already exists. |