Decision Table row creation failing with 400 Bad Request

Platform SDK for JS - we’re getting a 400 Bad Request when trying to add rows to a decision table. It’s happening on POST /api/v2/businessrules/decisiontables/{tableId}/versions/{tableVersion}/rows.

The table is created and the version is active, but the row push fails. It’s breaking our automated rule updates for the routing logic.

const client = new purecloud.PlatformClient();
// ... auth ...
const rowData = {
 "inputValues": ["Value1", "Value2"],
 "outputValues": ["Result1"]
};
await client.businessrulesApi.postDecisionTablesTableIdVersionsTableVersionRows(tableId, tableVersion, rowData);

The payload is correct based on the table definition. It’s not a permission issue since we can update the table itself via PATCH /api/v2/businessrules/decisiontables/{tableId} without any errors.

A 400 status during row creation typically indicates a schema mismatch between the payload and the decision table definition. If the tableVersion is active, it’s locked for edits. The API requires a draft version for any modifications to rows.

Try creating a new version first, adding the row to that draft, and then publishing. If the automated process is attempting to write directly to an active version, the request won’t be accepted.

// Example using the Platform SDK to ensure we're targeting a draft
const tableId = 'your-table-id';
const draftVersion = 'your-draft-version-id';

const rowData = {
 // Ensure these keys match the defined columns exactly
 columnValues: {
 "CustomerTier": "Gold",
 "Region": "EMEA"
 },
 resultValue: "Priority_Queue_1"
};

try {
 await platformClient.businessRules.postDecisionTableRow(tableId, draftVersion, rowData);
} catch (e) {
 console.error('Row creation failed:', e);
}

Is the automation checking the version status before the POST call? One gotcha is that any trailing whitespace in the column names within the payload can trigger this error. If the column definitions were updated recently, the cached schema in the automation script might be outdated.

1 Like