Create/update/delete Contract Item
/v1/contractitem
Create , update or delete Contract Item
Example for calling:
http://server/v1/contractitem
Request Body = {….} see request fields below
Allowed Methods:
[POST]
API Controller: contractitem
Description:
Create / update / delete contract item is done in one single Web Service call with an indicator to specify Create, Update or Delete.
Notice that Update is not supported, only Create and Delete actions.
Request Fields:
| Name | Type | Description | Notes |
|---|---|---|---|
| create_contractitem | create_contractitem[] | collection of contract items to be created/ |
Head element not specified – see example |
create_contractitem
| Name | Type | Description |
|---|---|---|
| Rowid | integer | identifying a row in this request that lines up with the response |
| Action | string | specification of action: “C”reate, |
| Contractitem | Contractitem[] | Contract Item object (same structure as GET object) |
Create Action
WBS
- wbs.id is ignored.
- wbs.code is mandatory.
- If the code exists - its database id is used.
- If it does not exist - a new WBS is created using the provided code.
- WBS: identified by code
- wbs.description is used only when creating a new WBS.
Type
- type.type is used to look up an existing type.
- If found - that type is used.
- If not found - a new type is created using the provided values.
- type.description is used only when creating a new type.
- identified by type.type
Comments
- Every comment in the list is checked.
- If a comment does not exist, it is inserted into the database.
- If it exists - it is ignored (not updated).
Documents
- Each document is considered.
- A new document is inserted only if no existing document has the same (description, name) combination.
User-defined fields (userfieldX)
- Each userfieldX.fieldnr is checked.
- If it does not exist - a new label record is created using the provided details.
- If it exists - the existing database details take priority (the provided details are ignored).
Person
- For companyrepresentative and customerrepresentative:
- If the signature does not exist - a new record is created.
- name is used only when creating a new signature.
- If it already exists - the provided details are ignored.
- identified by signature
Contract items
- The provided contract item details are used.
- The id field is ignored during creation.
- The system generates a new id.
Delete Action
The Delete action supports removing the following entities in a single request:
- A contract item
- A WBS item
- Both a contract item and a WBS item
Behavior
If both a contract item and a WBS item are specified, the API will attempt to delete each of them.
If only one of the entities is specified, only that entity will be deleted.
Deleting a WBS item will succeed only if the WBS structure does not contain any contract items.
If the WBS item hosts one or more contract items, the delete operation for the WBS item will fail.
Required Fields
The following fields are mandatory for the delete of a contract and/or WBS item operation:
- projectid - identifies the parent project.
- id - identifies the specific contract item within the project to be deleted.
- wbs.id identifier of the specific wbs item with in the project to be deleted.
The projectId field must always be provided.
Additionally, either id and/or wbs.id must be provided, depending on what is to be deleted.
Delete Behavior
The system will attempt to delete the entity identified by one or both of the following combinations:
- projectid + id
- projectid + wbs.id
If no matching record is found, the delete action will have no effect (idempotent behavior).
If a matching record exists, it will be removed permanently from the database.
Constraints and Validation
- The id must belong to the given projectid.
- The wbs.id must belong to the given projectid.
- If the item does not belong to the specified project, the delete action will be rejected.
Response Fields:
create_contractitem_response[] – collection of create_contractitem_response objects
| Name | Type | Description | Notes |
|---|---|---|---|
| rowId | integer | corresponds to the RowID in the request | |
| result | char | S(uccess) or F(ail) indicating if the requested action was successfully executed | |
| message | string | Message text of the result, error message in case of failure | |
| messageid | integer | MessageId: Identifies error message | |
| contractitem_id | integer | Safran sub_project.prj_id |
Sample Create Contract Item Call and Response
Show Call Sample
json request
[
{
"rowid":1,
"action": "C",
"projectid": 32,
"wbs": {
"id": 1,
"code": "WBS 1",
"description": ""
},
"code": "C 130",
"alias": "C 130",
"type": {
"type": "",
"description": ""
},
"id": 1,
"registered": "2026-03-30T13:32:14.123",
"baselined": null,
"companyrepresentative": {
"signature": "JUL",
"name": "Jostein Ullestad"
},
"customerrepresentative": {
"signature": "",
"name": ""
},
"userfield1": {
"fieldnr": 1,
"label": "Reference 12",
"connectedfieldnr": 12,
"autoupdate": false,
"value": ""
},
"userfield2": {
"fieldnr": 2,
"label": "Field 2",
"connectedfieldnr": 0,
"autoupdate": false,
"value": "test 2"
},
"userfield3": null,
"userfield4": null,
"userfield5": null,
"userfield6": null,
"userfield7": null,
"userfield8": null,
"userfield9": null,
"userfield10": null,
"userfield11": null,
"userfield12": null,
"userfield13": null,
"userfield14": null,
"userfield15": null,
"userfield16": null,
"description": "",
"document": [
{
"description": "Docs 100",
"name": "c:\temp\test1.txt"
},
{
"description": "Docs 101",
"name": "c:\temp\test2.txt"
}
],
"comment": []
}
]
Show Response Sample
json result
[
{
"contractitem_Id": 11,
"rowId": 1,
"result": "S",
"message": "The contract item was created.",
"messageId": null
}
]
Sample Delete Contract Item Call and Response
Show Call Sample
json request
[
{
"rowid":1,
"action": "D",
"projectid": 32,
"id": 11
}
]
Show Response Sample
json result
[
{
"contractitem_id": 10,
"rowId": 1,
"result": "S",
"message": "The contract item was deleted.",
"messageId": null
}
]