Connection Field Blank in HIPAA API POST Call to "insert connected record"

Hi everyone,

I’m having trouble creating a connected record via the form API in our HIPAA app. Both forms are configured to insert a new [RecordType] record that is connected to this page’s [Connection Record]. However, while one API call works correctly, the other returns an empty connection field.


Scenario 1 – Non-Working (Form on SCENE_A/VIEW_A):

In this case, I’m using the HIPAA endpoint and passing the connection field as an object with an id property:

// Non-Working Example
var recordId = "RECORD_ID";
var APP_ID   = "YOUR_APP_ID";
var userToken = "USER_TOKEN";

// Payload: connection field passed as an object with an id property
var payload = {
  "field_CONN": { "id": recordId }
};

$.ajax({
  url: "https://usgc-api.knack.com/v1/pages/SCENE_A/views/VIEW_A/records",
  type: "POST",
  headers: {
    "X-Knack-Application-Id": APP_ID,
    "Authorization": userToken,
    "Content-Type": "application/json"
  },
  data: JSON.stringify(payload),
  success: function(response) {
    console.log("Response:", response);
  }
});

The call succeeds (it returns a new record ID and a submit_key), but the connection field (field_CONN) comes back empty.

IF I include the connection field in the form as an input field, it comes through correctly. In the working example below the connection field doesn’t need to be in the actual form as an input field


Scenario 2 – Working (Bulk Update – Form on SCENE_B/VIEW_B):

Here, a similar API call is made in a bulk update process. The connection field is passed in the same way:

// Working Example
var licenseId = "LICENSE_ID";
var APP_ID   = "YOUR_APP_ID";
var userToken = "USER_TOKEN";

// Payload: connection field passed as an object with an id property
var payload = {
  "field_CONN": { "id": licenseId }
};

$.ajax({
  url: "https://api.knack.com/v1/pages/SCENE_B/views/VIEW_B/records",
  type: "POST",
  headers: {
    "Authorization": userToken,
    "X-Knack-Application-ID": APP_ID,
    "Content-Type": "application/json"
  },
  data: JSON.stringify(payload),
  success: function(response) {
    console.log("Response:", response);
  }
});

In this case, the connection field is correctly populated in the returned record.


Summary:

  • Both scenarios: Pass the connection field as an object with an id property.
  • Scenario 1: Uses the HIPAA endpoint (usgc-api.knack.com) on SCENE_A/VIEW_A.
  • Scenario 2: Uses the standard endpoint (api.knack.com) on SCENE_B/VIEW_B.
  • Both forms: Are set up to insert a new [RecordType] record connected to this page’s [Connection Record].

Given that both API calls pass the connection field in the same manner, what might be causing the connection field to remain blank in Scenario 1? Could differences in endpoint handling or form configuration be responsible?

Any insights or suggestions would be greatly appreciated!

Thanks in advance.

@ivan From experience and from testing using your code (with both endpoints), it all boils down to whether the form you’re POSTing to includes the connection field or not.

Also noting that your payload will also work in this format for single connections:

const licenseId = '67bd099326526g5beb3f874b'
var payload = {
    field_430: licenseId
  };

Hope that helps!

Thanks, appreciate it!