const revisions = await client.revisions3D.create(4234325345643654, [{ fileId: 8252999965991682 }, { fileId: 6305529564379596 }]);from cognite.client.data_classes import ThreeDModelRevisionWrite
my_revision = ThreeDModelRevisionWrite(file_id=1)
res = client.three_d.revisions.create(model_id=1, revision=my_revision)Path fileAOriginal = Paths.get("./src/test/resources/csv-data.txt");
List<FileContainer> fileContainerInput = new ArrayList<>();
FileMetadata fileMetadata = FileMetadata.newBuilder()
.setExternalId("10")
.setName("test_file_.test")
.setSource("sdk-data-generator")
.putMetadata("type", "sdk-data-generator")
.build();
FileContainer fileContainer = FileContainer.newBuilder()
.setFileMetadata(fileMetadata)
.setFileBinary(FileBinary.newBuilder()
.setBinaryUri(fileAOriginal.toUri().toString()))
.build();
fileContainerInput.add(fileContainer);
List<FileMetadata> uploadFileResult =
client.files().upload(fileContainerInput);
ThreeDModelRevision.Camera camera = ThreeDModelRevision.Camera.newBuilder()
.addPosition(2.707411050796509).addPosition(-4.514726638793945).addPosition(1.5695604085922241)
.addTarget(0.0).addTarget(-0.002374999923631549).addTarget(1.5695604085922241)
.build();
ThreeDModelRevision revision = ThreeDModelRevision.newBuilder()
.setFileId(uploadFileResult.get(0).getId()).setCamera(camera).addRotation(new Random().nextInt(100) / 100.0)
.build();
List<ThreeDModelRevision> listUpsert =
client.threeD()
.models()
.revisions()
.upsert(10L, List.of(revision));curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/3d/models/{modelId}/revisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"fileId": 123,
"published": false,
"rotation": [
0,
0,
0
],
"scale": [
1,
1,
1
],
"translation": [
0,
0,
0
],
"metadata": {},
"nonce": "<string>",
"pipelineConfiguration": {
"indexingOptions": {
"extractPhotosphereImages": false,
"dmsInstancesSpaceId": "<string>"
},
"processTilesOptions": {
"saveAnnotations": true
}
}
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{cluster}.cognitedata.com/api/v1/projects/{project}/3d/models/{modelId}/revisions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'fileId' => 123,
'published' => false,
'rotation' => [
0,
0,
0
],
'scale' => [
1,
1,
1
],
'translation' => [
0,
0,
0
],
'metadata' => [
],
'nonce' => '<string>',
'pipelineConfiguration' => [
'indexingOptions' => [
'extractPhotosphereImages' => false,
'dmsInstancesSpaceId' => '<string>'
],
'processTilesOptions' => [
'saveAnnotations' => true
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{cluster}.cognitedata.com/api/v1/projects/{project}/3d/models/{modelId}/revisions"
payload := strings.NewReader("{\n \"items\": [\n {\n \"fileId\": 123,\n \"published\": false,\n \"rotation\": [\n 0,\n 0,\n 0\n ],\n \"scale\": [\n 1,\n 1,\n 1\n ],\n \"translation\": [\n 0,\n 0,\n 0\n ],\n \"metadata\": {},\n \"nonce\": \"<string>\",\n \"pipelineConfiguration\": {\n \"indexingOptions\": {\n \"extractPhotosphereImages\": false,\n \"dmsInstancesSpaceId\": \"<string>\"\n },\n \"processTilesOptions\": {\n \"saveAnnotations\": true\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://{cluster}.cognitedata.com/api/v1/projects/{project}/3d/models/{modelId}/revisions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"fileId\": 123,\n \"published\": false,\n \"rotation\": [\n 0,\n 0,\n 0\n ],\n \"scale\": [\n 1,\n 1,\n 1\n ],\n \"translation\": [\n 0,\n 0,\n 0\n ],\n \"metadata\": {},\n \"nonce\": \"<string>\",\n \"pipelineConfiguration\": {\n \"indexingOptions\": {\n \"extractPhotosphereImages\": false,\n \"dmsInstancesSpaceId\": \"<string>\"\n },\n \"processTilesOptions\": {\n \"saveAnnotations\": true\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"id": 1000,
"fileId": 1000,
"published": false,
"status": "Done",
"assetMappingCount": 0,
"createdTime": 0,
"rotation": [
0,
0,
0
],
"scale": [
1,
1,
1
],
"translation": [
0,
0,
0
],
"camera": {
"target": [
123
],
"position": [
123
]
},
"metadata": {},
"thumbnailThreedFileId": 1000,
"thumbnailURL": "https://api.cognitedata.com/api/v1/project/myproject/3d/files/1000"
}
]
}{
"error": {
"code": 401,
"message": "Could not authenticate.",
"missing": [
{}
],
"duplicated": [
{}
]
}
}Create 3D revisions
Required capabilities:
threedAcl:CREATE
Creates revision(s) and starts processing job(s).
Check beta API documentation for information about additional options.
Hybrid projects: Use the CreateRevision3DClassicAndHybridBody to create revisions.
DataModelOnly: Please use the 3d/jobs endpoint (Beta for now) to create the revision(s) and start jobs. CreateRevision3DDmsOnlyBody will eventually be deprecated.
const revisions = await client.revisions3D.create(4234325345643654, [{ fileId: 8252999965991682 }, { fileId: 6305529564379596 }]);from cognite.client.data_classes import ThreeDModelRevisionWrite
my_revision = ThreeDModelRevisionWrite(file_id=1)
res = client.three_d.revisions.create(model_id=1, revision=my_revision)Path fileAOriginal = Paths.get("./src/test/resources/csv-data.txt");
List<FileContainer> fileContainerInput = new ArrayList<>();
FileMetadata fileMetadata = FileMetadata.newBuilder()
.setExternalId("10")
.setName("test_file_.test")
.setSource("sdk-data-generator")
.putMetadata("type", "sdk-data-generator")
.build();
FileContainer fileContainer = FileContainer.newBuilder()
.setFileMetadata(fileMetadata)
.setFileBinary(FileBinary.newBuilder()
.setBinaryUri(fileAOriginal.toUri().toString()))
.build();
fileContainerInput.add(fileContainer);
List<FileMetadata> uploadFileResult =
client.files().upload(fileContainerInput);
ThreeDModelRevision.Camera camera = ThreeDModelRevision.Camera.newBuilder()
.addPosition(2.707411050796509).addPosition(-4.514726638793945).addPosition(1.5695604085922241)
.addTarget(0.0).addTarget(-0.002374999923631549).addTarget(1.5695604085922241)
.build();
ThreeDModelRevision revision = ThreeDModelRevision.newBuilder()
.setFileId(uploadFileResult.get(0).getId()).setCamera(camera).addRotation(new Random().nextInt(100) / 100.0)
.build();
List<ThreeDModelRevision> listUpsert =
client.threeD()
.models()
.revisions()
.upsert(10L, List.of(revision));curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/3d/models/{modelId}/revisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"fileId": 123,
"published": false,
"rotation": [
0,
0,
0
],
"scale": [
1,
1,
1
],
"translation": [
0,
0,
0
],
"metadata": {},
"nonce": "<string>",
"pipelineConfiguration": {
"indexingOptions": {
"extractPhotosphereImages": false,
"dmsInstancesSpaceId": "<string>"
},
"processTilesOptions": {
"saveAnnotations": true
}
}
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{cluster}.cognitedata.com/api/v1/projects/{project}/3d/models/{modelId}/revisions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'fileId' => 123,
'published' => false,
'rotation' => [
0,
0,
0
],
'scale' => [
1,
1,
1
],
'translation' => [
0,
0,
0
],
'metadata' => [
],
'nonce' => '<string>',
'pipelineConfiguration' => [
'indexingOptions' => [
'extractPhotosphereImages' => false,
'dmsInstancesSpaceId' => '<string>'
],
'processTilesOptions' => [
'saveAnnotations' => true
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{cluster}.cognitedata.com/api/v1/projects/{project}/3d/models/{modelId}/revisions"
payload := strings.NewReader("{\n \"items\": [\n {\n \"fileId\": 123,\n \"published\": false,\n \"rotation\": [\n 0,\n 0,\n 0\n ],\n \"scale\": [\n 1,\n 1,\n 1\n ],\n \"translation\": [\n 0,\n 0,\n 0\n ],\n \"metadata\": {},\n \"nonce\": \"<string>\",\n \"pipelineConfiguration\": {\n \"indexingOptions\": {\n \"extractPhotosphereImages\": false,\n \"dmsInstancesSpaceId\": \"<string>\"\n },\n \"processTilesOptions\": {\n \"saveAnnotations\": true\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://{cluster}.cognitedata.com/api/v1/projects/{project}/3d/models/{modelId}/revisions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"fileId\": 123,\n \"published\": false,\n \"rotation\": [\n 0,\n 0,\n 0\n ],\n \"scale\": [\n 1,\n 1,\n 1\n ],\n \"translation\": [\n 0,\n 0,\n 0\n ],\n \"metadata\": {},\n \"nonce\": \"<string>\",\n \"pipelineConfiguration\": {\n \"indexingOptions\": {\n \"extractPhotosphereImages\": false,\n \"dmsInstancesSpaceId\": \"<string>\"\n },\n \"processTilesOptions\": {\n \"saveAnnotations\": true\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"id": 1000,
"fileId": 1000,
"published": false,
"status": "Done",
"assetMappingCount": 0,
"createdTime": 0,
"rotation": [
0,
0,
0
],
"scale": [
1,
1,
1
],
"translation": [
0,
0,
0
],
"camera": {
"target": [
123
],
"position": [
123
]
},
"metadata": {},
"thumbnailThreedFileId": 1000,
"thumbnailURL": "https://api.cognitedata.com/api/v1/project/myproject/3d/files/1000"
}
]
}{
"error": {
"code": 401,
"message": "Could not authenticate.",
"missing": [
{}
],
"duplicated": [
{}
]
}
}Authorizations
Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.
Path Parameters
Model ID.
Body
The revisions to create.
- Option 1
- Option 2
1 - 1000 elementsShow child attributes
Show child attributes
Response
A list of created revisions.
Show child attributes
Show child attributes
Was this page helpful?