curl --request POST \
--url https://davinci-app.com/api/v2/projects/{projectId}/objects \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"objects": {}
}'import os
import uuid
from davinci_sdk import DavinciClient
with DavinciClient(api_key=os.environ["DAVINCI_API_KEY"]) as client:
result = client.content.add_objects(
project_id,
objects={str(uuid.uuid4()): {"type": "requirement", "name": "Dry mass under 500 kg"}},
)
print(result.added_count)
import { DavinciClient } from '@celedon/davinci-sdk';
const client = new DavinciClient({
apiKey: process.env.DAVINCI_API_KEY!,
});
const { addedCount } = await client.content.addObjects(projectId, {
objects: {
[crypto.randomUUID()]: { type: 'requirement', name: 'Dry mass under 500 kg' },
},
});
console.log(addedCount);
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({objects: {}})
};
fetch('https://davinci-app.com/api/v2/projects/{projectId}/objects', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"addedCount": 2,
"objectIds": [
"<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": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Add objects
Adds objects to the running project, opening it if needed. The write goes through the same path an interactive client uses, so parentage, layout, and the broadcast to anyone else in the project all happen as normal.
The objects are in memory once this returns; they are in git only after a commit. A response reporting fewer objects than were sent does not happen — the request either applies in full or fails.
Every object is checked against the schema for its type before anything
is written, so one bad object fails the whole request and the project is
left untouched. Any type the model defines can be written here; the 400
names what was wrong with each object it refused.
curl --request POST \
--url https://davinci-app.com/api/v2/projects/{projectId}/objects \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"objects": {}
}'import os
import uuid
from davinci_sdk import DavinciClient
with DavinciClient(api_key=os.environ["DAVINCI_API_KEY"]) as client:
result = client.content.add_objects(
project_id,
objects={str(uuid.uuid4()): {"type": "requirement", "name": "Dry mass under 500 kg"}},
)
print(result.added_count)
import { DavinciClient } from '@celedon/davinci-sdk';
const client = new DavinciClient({
apiKey: process.env.DAVINCI_API_KEY!,
});
const { addedCount } = await client.content.addObjects(projectId, {
objects: {
[crypto.randomUUID()]: { type: 'requirement', name: 'Dry mass under 500 kg' },
},
});
console.log(addedCount);
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({objects: {}})
};
fetch('https://davinci-app.com/api/v2/projects/{projectId}/objects', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"addedCount": 2,
"objectIds": [
"<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": {}
}
}{
"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
Personal access token. The scopes granted at issuance determine both which
operations the key may call and the ceiling on the resource permissions it
can exercise. Each scope family is a ladder: projects:manage implies
projects:write and projects:read; cards:manage implies cards:write
and cards:read; and teams:manage implies teams:write and teams:read.
These are named API capability bundles, not blanket domain roles:
manage exposes only the permissions enumerated for that scope and never
bypasses the acting user's current role-based access.
Path Parameters
Project id. May be compound in the form {projectId}--{branchName}.
1Query Parameters
Body
Objects to add, keyed by the id each should take. A key is an id, so it must be a UUID — mint one per object. Ids must be unique within the project; reusing one overwrites, which is why guessable keys are not accepted.
Each body is validated against the schema for its type. Fields
differ by type, anything the type does not define is refused rather
than dropped, and every field is optional except type — the model
supplies the rest.
tags is refused here rather than accepted and discarded: creation
does not carry them. Assign them once the object exists.
Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Any object type the model defines: task, requirement, part,
attribute, risk, test, package, and the rest. A 400 for an
unrecognised type lists them all in details.validTypes.
Overrides parentId for this object.
Parent for objects that do not name one themselves. An id, so a UUID.