Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 4.01 KB

File metadata and controls

59 lines (43 loc) · 4.01 KB

Erply PIM Integration (Linx + SQLite)

This project provides a Linx-based integration to pull product, inventory, and related metadata from the Erply platform using both the PIM, Inventory and Pricing APIs. The data is stored in a local SQLite database (SessionData.db by default) and can be extended to integrate with other platforms such as Shopify.

Project Structure

  • Linx/
    Contains the Linx solution and all logic for interacting with the Erply APIs.

  • Database/
    Contains the database file and SQL scripts:

    • SessionData.db – Preconfigured SQLite database for immediate use.
    • MSSQL Create Table.sql – SQL script to create required tables for MSSQL.
    • SQLite Create Table.sql – SQL script to create required tables for SQLite.

Configuration

Before running the solution, configure the following settings in Linx:

Setting Description
DatabaseConnectionString Connection string to your SQLite or MSSQL database
ErplyAccountNumber Your Erply account number
ErplyUserName Your Erply username
ErplyPassword Your Erply password
ErplyInventoryBaseURL Base URL for Classic API inventory endpoints (retrieved via getServiceEndpoints)
ErplyPIMBaseURL Base URL for PIM API endpoints (retrieved via getServiceEndpoints)
ErplyPricingBaseURL Base URL for Classic API pricing endpoints (retrieved via getServiceEndpoints)

The above URLs are region-dependent. Use the getServiceEndpoints function to dynamically retrieve the correct endpoints after supplying your ErplyAccountNumber.

Core Functions

GetSessionKey

Checks for an existing, valid session key in the database. If none is found or the key has expired, it requests a new session key from the Erply Classic API.

GetErplyProductData

This is the primary orchestrator function. It performs all necessary calls to retrieve and enrich product data from both the PIM and Classic APIs. It includes data on stock levels, suppliers, brands, product groups, tax rates, and more.

Worker Functions

These functions support GetErplyProductData by retrieving details for specific fields:

Function Description
GetBrands Retrieves brand details by brand ID
GetProductCategory Retrieves category details by category ID
GetProductGroupName Retrieves product group details by ID
GetProducts(skip, take) Retrieves product data in batches using pagination parameters
GetStockLevelForProduct Retrieves total stock for a given product across all warehouses
GetSupplier Retrieves supplier details by ID
GetTaxRate Retrieves tax rate details by ID
getServiceEndpoints Utility function to retrieve API base URLs for the account’s region

Usage Notes

  • Pagination is implemented manually using skip and take parameters in the GetProducts function.
  • Data returned by GetErplyProductData is enriched and can be passed directly into other processes or integrations.
  • The SQLite database (SessionData.db) can be used out of the box, or you can recreate the schema using the included SQL scripts.