curl --request POST \
--url https://api.comstruct.com/v1/projects \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"title": "Highway Construction Project",
"project_number": "HCP-2024-001",
"external_id": "EXT-2024-001",
"description": "Construction of highway section A1-A2",
"region": "Bavaria",
"active": true
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "EXT-001",
"title": "Example Site",
"project_number": "23423420",
"description": "<string>",
"region": "Bavaria",
"project_region_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"active": true,
"latitude": 48.1351,
"longitude": 11.582,
"alternative_project_number": "<string>",
"status": "<string>",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"address": {
"address": "<string>",
"city": "<string>",
"country": "<string>",
"house_number": "<string>",
"zip": "<string>"
},
"legal_entity": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"number": "<string>"
},
"project_invites": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "jsmith@example.com",
"role": "<string>",
"role_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}Projects
Create project
Erforderliche Berechtigungen: projects:write, users:read, roles:read, tenant_settings:read
Erstellt ein neues Projekt oder aktualisiert ein bestehendes Projekt. Dieser Endpunkt führt eine Upsert-Operation basierend auf dem external_id-Feld (falls vorhanden) oder der project_number durch.
Hauptfunktionen:
- Upsert-Logik: Wenn
external_idangegeben ist und ein Projekt mit dieser ID existiert, wird es aktualisiert. Andernfalls wirdproject_numberfür den Abgleich verwendet. Wenn keine Übereinstimmung gefunden wird, wird ein neues Projekt erstellt. - Benutzerverwaltung: Behandelt automatisch Benutzereinladungen und Rollenzuweisungen für Projektteammitglieder.
- Regionszuordnung: Das
region-Feld kann verwendet werden, um das Projekt einer Projektregion zuzuordnen. - Buchungskreis-Zuordnung: Das
legal_entity_number-Feld kann verwendet werden, um das Projekt einem Buchungskreis zuzuordnen. - Koordinaten: Optionale
latitudeundlongitudesetzen den geografischen Standort. Weglassen belässt den gespeicherten Wert;nulllöscht ihn. - Validierung: Alle erforderlichen Felder (
title,project_number) werden vor der Verarbeitung validiert.
Best Practices:
- Geben Sie
external_idfür zuverlässige Upsert-Operationen an - Verwenden Sie
regionoderproject_region_idfür die Projektregionszuordnung - Verwenden Sie
legal_entity_numberoderlegal_entity_idfür die Buchungskreis-Zuordnung - Fügen Sie vollständige Adressinformationen hinzu, wenn verfügbar, für besseres Projektmanagement
- Übergeben Sie
latitudeundlongitudegemeinsam, wenn der Standort bekannt ist - Stellen Sie sicher, dass Rollennamen in
project_invitesmit bestehenden Rollen in Ihrem Mandanten übereinstimmen
POST
/
projects
curl --request POST \
--url https://api.comstruct.com/v1/projects \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"title": "Highway Construction Project",
"project_number": "HCP-2024-001",
"external_id": "EXT-2024-001",
"description": "Construction of highway section A1-A2",
"region": "Bavaria",
"active": true
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "EXT-001",
"title": "Example Site",
"project_number": "23423420",
"description": "<string>",
"region": "Bavaria",
"project_region_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"active": true,
"latitude": 48.1351,
"longitude": 11.582,
"alternative_project_number": "<string>",
"status": "<string>",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"address": {
"address": "<string>",
"city": "<string>",
"country": "<string>",
"house_number": "<string>",
"zip": "<string>"
},
"legal_entity": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"number": "<string>"
},
"project_invites": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "jsmith@example.com",
"role": "<string>",
"role_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}Authorizations
Body
application/json
Response
Projekt erfolgreich erstellt oder aktualisiert