...
4) Good practice: handling objects connected to third parties
You may have - or anticipate to have - a couple of integrations with platforms like Maestrano, QuickBooks, Xero, SalesForce etc. . and each of these platforms ask which will require you to synchronize objects using their APIs. For each of these objects, you will need to keep track of the foreign ids associated with the objects you've remotely created and/or received . This is what we call ("connected objects"). Now the question
Question is: how to handle this properlyproperly handle the linking of remote objects to your application models?
Maestrano's approach and recommended way of doing this is to use an identity map table (or "id map"). An identity id map is is a join table allowing you to link a any kind of model on your side to a remote entity entities on the other side.
Models The id map identifies models/records in your application will be identified byusing the following fields:
- ID: the id of the record in your model table (e.g.: invoices table)
- Class: the name of the class for your model (e.g.: Invoice)
Remote On the other side, remote entities will be identified byusing the following fields:
- Provider: the partner holding the entity (e.g.: Maestrano, Acme Corp, Xero, QuickBooks etc.)
- Realm: the ID of the customer account (organization/company or user) who owns the remote entity.
- Entity: the name of the remote entity. You should be able to derive the path of the entity API endpoint from this name.
- RID: the ID of the remote entity.
...