I am looking at integrating an application with ERPNext. So I need to sync/export the data from application(mainly customer/sales information) to erpnext. The application will be running on the same system as ERPNext, so I have two ways of doing it
- Map the relevant fields and update the database directly
- Add a REST API and use the API to export the data from application
I initially preferred API approach over database as it will work at a higher level reducing some effort. I thought it might work better for upgrades where underlying database schema might change. But not really sure whether it is a real concern as most of the upgrade patches work at providing a smooth upgrade path. Also, the schema changes are usually triggered by doctype changes, so both will need code changes to the data export logic. Is there any specific reason for me to avoid database updates directly?