curl --request GET \
--url https://davinci-app.com/api/v1/file/download/{ownerId}/{projectId}/{fileName} \
--header 'Authorization: Bearer <token>'import os
from davinci_sdk import DavinciClient
with DavinciClient(api_key=os.environ["DAVINCI_API_KEY"]) as client:
session = client.sessions.create(project_id)
data = session.download("housing.step")
print(len(data))
import { DavinciClient } from '@celedon/davinci-sdk';
const client = new DavinciClient({
apiKey: process.env.DAVINCI_API_KEY!,
});
const session = await client.sessions.create(projectId);
const bytes = await session.download('housing.step');
console.log(bytes.byteLength);
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://davinci-app.com/api/v1/file/download/{ownerId}/{projectId}/{fileName}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));"<string>"{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Download a file from a project
Streams a file from the machine holding your project.
Send this to dataPlane.url with Authorization: Bearer {dataPlane.token}.
Prefer this over the control-plane downloadProjectFile for large files: the
bytes travel directly rather than through the API server, with a 30-minute
window rather than 15.
A file belonging to a different project is served only when your project has an active include referencing it — the same rule the editor follows.
curl --request GET \
--url https://davinci-app.com/api/v1/file/download/{ownerId}/{projectId}/{fileName} \
--header 'Authorization: Bearer <token>'import os
from davinci_sdk import DavinciClient
with DavinciClient(api_key=os.environ["DAVINCI_API_KEY"]) as client:
session = client.sessions.create(project_id)
data = session.download("housing.step")
print(len(data))
import { DavinciClient } from '@celedon/davinci-sdk';
const client = new DavinciClient({
apiKey: process.env.DAVINCI_API_KEY!,
});
const session = await client.sessions.create(projectId);
const bytes = await session.download('housing.step');
console.log(bytes.byteLength);
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://davinci-app.com/api/v1/file/download/{ownerId}/{projectId}/{fileName}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));"<string>"{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Authorizations
A session's data-plane grant, from dataPlane.token. Valid only on the
data-plane host, only for the one project its session opened, and only for
minutes.
A grant is not an API key and the two are not interchangeable: presenting a grant to a control-plane operation is rejected, and an API key is not accepted on the data plane. The separation is deliberate — a grant is meant to be cheap to lose, so it reaches one project, does no more than the key that minted it, and is revoked when its session closes.
Path Parameters
Id of the account or organization that owns the project, from the project's
ownerId.
1Project id, compound as {projectId}--{branchName}. Must be the project the
session opened.
1Stored filename, in the form {fileId}.{extension}.
1Response
File bytes.
The response is of type file.