API – Linking Records

Linking PYXI Core Records to Existing Application Records

It is a common requirement to have a PYXI Core Record that is an ‘extension’ of a record in an existing application. For example, an application with Customer records which is going to utilise enhanced functionality in PYXI Core, will typically need a PYXI Organisation record for each of its own customer records, as and when such functionality is triggered for that customer.

There are fundamentally two ways of linking the two records.

Store the PYXI Record ID in the Existing Application

When the PYXI Organisation record is created (using the Add Record API call), its record ID is returned. Store this record ID in a new field in the existing application, then pass this record ID in all subsequent API calls relating to the record.

The disadvantage of this approach is that it requires technical modification of the existing application code (and probably database schema) to provide the additional field. Given that PYXI is often used to expand an existing application’s functionality because it is difficult, impossible, too expensive or too risky to modify the existing code, there must be a better way.

Store the Existing Application’s Unique Record Identifier in a Field in PYXI

Alternatively, set-up a Field in PYXI – e.g. if your existing application is called MyApp, you might set-up a field called MyAppRecordID.

Sample Blueprint

[Field] RecordTypeName, FieldName, FieldType, FieldLength Organisation, MyAppRecordID, text, 30

When creating the PYXI Organisation record (using the Add Record API call), include the existing record ID in MyAppRecordID in the data provided. This means the PYXI application now has a reference to the existing application’s record.

Sample Request

{ "account": *** your account id ***, "apikey": "*** your api key ***", "action": "add", "recordtype": "organisation", "values": { … "MyAppRecordID": 987654321, … } }

Now when making any subsequent API calls relating to the record, simply pass its record type (organisation) and a filter of MyAppRecordID=nnnn. This will still be as performant as providing the internal record ID, as all Field values are indexed in PYXI Core.

Sample Request

{ "account": *** your account id ***, "apikey": "*** your api key ***", "action": …, "recordtype": "organisation", "filter": "MyAppRecordID=987654321" }

There are various advantages to this approach:

  1. There is no need for any technical modification of the existing application code or database
  2. The existing application’s record ID is available within PYXI Core so can easily be included in any WebHooks or other communications between PYXI Core and the existing application (or other applications as necessary)

Get Started