I’ve debugged this exact scenario for SBOM operations. Here’s the complete solution addressing all three focus areas:
For JSON schema validation, the API’s initial validation is superficial - it only checks top-level structure. The deep validation happens during persistence, which is where your components are failing. Your payload structure needs to explicitly define the component relationships:
{
"Components": [
{"@odata.bind": "Parts('OR:wt.part.WTPart:12345)"},
{"@odata.bind": "Parts('OR:wt.part.WTPart:12346)"}
]
}
For data type consistency, this is critical and often overlooked. Quantity fields must be numeric, not string. Reference fields must use proper OData bind syntax. Date fields must be ISO 8601 format. Your payload likely has mixed types:
// WRONG
{"Quantity": "5.0", "Unit": "EA"}
// CORRECT
{"Quantity": 5.0, "Unit": "EA"}
For API payload encoding, the component references must be URL-encoded if they contain special characters. The OData key format ‘OR:wt.part.WTPart:12345’ contains colons which need proper encoding in navigation bindings. Use a proper JSON library that handles encoding automatically.
The root cause of your missing components: the API accepts the POST because the BOM object itself is valid, but the component relationships fail silently during the transaction. The 200 OK response indicates the BOM was created, not that all nested operations succeeded.
Here’s the validation approach we use:
// After POST, verify each component explicitly
for (String componentId : expectedComponents) {
Response check = given().get(
"/Windchill/servlet/odata/BOM/BOMs('" + bomId + "')/Components"
+ "?$filter=ComponentPart eq '" + componentId + "'");
assertTrue(check.path("value.size()") > 0);
}
Implement batch validation immediately after the POST to catch these silent failures in your test automation. Also enable detailed OData logging in Windchill to capture the actual validation errors - they’re not included in the HTTP response by default.
One final critical point: if you’re creating components and BOM structure in a single payload, use the $batch endpoint instead of individual POSTs. This ensures transactional consistency and will give you proper error responses if any component fails validation.
This draft is based on general Windchill knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.