curl --request POST \
--url https://api.comstruct.com/v1/projects/{id}/work-types \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
[
{
"code": "1000",
"title": "Rohbau",
"parent": "",
"description": "Rohbauarbeiten Gebäude A"
}
]
'[
{
"code": "1000",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "Rohbau",
"parent": "100",
"description": "Rohbauarbeiten Gebäude A",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]Projects
Import project work types
Erforderliche Berechtigungen: projects:write
Erstellt oder aktualisiert eine oder mehrere Kategorien für ein Projekt.
Der Abgleich erfolgt über das eindeutige Paar (project_id, code). Doppelte code-Werte in derselben Anfrage behalten die letzte Zeile.
Ausgelassene parent- und description-Felder werden als leere Zeichenkette gespeichert, damit ein Re-Import bestehende Werte überschreibt.
Leere oder nur aus Leerzeichen bestehende code- oder title-Werte führen zu HTTP 400; der Batch wird nicht teilweise importiert.
POST
/
projects
/
{id}
/
work-types
curl --request POST \
--url https://api.comstruct.com/v1/projects/{id}/work-types \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
[
{
"code": "1000",
"title": "Rohbau",
"parent": "",
"description": "Rohbauarbeiten Gebäude A"
}
]
'[
{
"code": "1000",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "Rohbau",
"parent": "100",
"description": "Rohbauarbeiten Gebäude A",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]Overview
Imports cost centers / work types (project structure) into a project. Existing rows with the samecode are updated (title, parent, description).
Resolve the project id first, for example with GET /projects/byProjectNumber/{project_number}.
Permissions
| Scope | Description |
|---|---|
projects:write | Create and update projects |
Behavior
- Matching uses
(project_id, code). - Duplicate
codevalues in the same request keep the last row. - Omitted
parentordescriptionfields are stored as an empty string so a re-import overwrites existing values. - Blank or whitespace-only
codeortitlevalues return HTTP 400; the batch is not partially imported. parentis only a number — there is no foreign-key check against the parent cost center.- If the project is not visible to the API key’s tenant, the API responds with 403.
Response codes
| Code | Description |
|---|---|
201 | Work types created or updated |
400 | Invalid request |
401 | Unauthorized |
403 | Project access denied or project not found |
Authorizations
Body
application/json
Response
Kategorien erfolgreich erstellt oder aktualisiert