INTRODUCTION
Linet API is bidirectional. Meaning:
Linet implements a RESTful approach to its API.
All data sent and received as JSON, by standard http POST, GET requests.
So, what can Linet API do for your app? It can:
- DOCUMENTS: Create, Print, Send, Delete, Update (Delete/Update: Only draft documents)
- ITEMS: Create, Search (Includes inventory query), Update, Delete
- ACCOUNTS: Create, Search, Update, Delete (Customers, suppliers etc, Warehouses are accounts as well)
- COMPANY: Create, Search, Delete
Every Linet subscriber can manage multiple businesses (“Companies”) under a single Linet subscription. If you have an app that needs legally acceptable accounting documents, inventory management, etc, for your multiple customers' businesses, under your single subscription, you can create a "company" for each one of them and let them have completely isolated access for each company. This will include creating documents with their own logo, digital signature etc.
- SETTINGS: Update company settings
- INVENTORY TRANSACTIONS: Can be executed through API by creating relevant types of documents.
- ACCOUNTING TRANSACTIONS: Can be executed through API by creating relevant types of documents
NOTE: There are some documents that can make both accounting and inventory transactions.
What Linet webhooks can do for you? It can notify your app about:
- ITEMS: On Create, Update, Delete
- DOCUMENTS: On Create, Update, Delete (Only draft status documents can be deleted)
- ACCOUNTS: On Create, Update, Delete
- ITEM CATEGORIES: On Create, Update, Delete
AUTHENTICATION
All API request to Linet endpoint must be authenticated by:
- A Pair of API ID and Key. Here is a guide How to retrieve this authentication pair from Linet UI.
- Company ID, Since all Linet tenants that have access to the API, are allowed to run at least 3 companies on a single subscription, whoever makes an API request, must provide the ID of the specific company within a subscriber. The same guide to retrieve authentication pair explains how to retrieve the company ID from Linet user interface.
API Authentication pair is associated to a Linet User
Every pair of ID and Key is associated with a specific Linet User and operates under this user's permissions and identity.
Therefore, all API requests authenticated by a pair will be recorded in the Linet system as executed by the user associated with this pair.
This feature is very useful on almost all reports, where we can identify which user made the deal/collected the payment.
Therefore, it is a very good practice to create a separate, specific, user for each integration with each external application and create an authentication pair associated with each one of those users.
Use case example for segregating API requests by two or more Linet users, authenticated each with its own API auth. pair:
Let's say we want to integrate two different websites to a single company under a Linet subscriber. We will certainly want to segregate the sales reports as by easily identifiable indicator which one of the websites made whatever sales have been made.
To accomplish this goal we will:
- Create 2 new users (Users can be created by UI).
- Give, each one, a human recognizable name like “Customers Site” and “Dealers Site”.
- Create two authentication pairs associated with each user.
- Then use the pair associated with the user named “Customers site” to execute requests from one site.
- Use the other pair on the Dealers site.
The result: Documents created by requests initiated at Dealers site will be recorded in the Linet system as created by the user “Dealers Site” and documents created by the customer's site will be recorded as created by the user “Customers site” . Later, we can get accurate sales reports which are associated with each website by the user who created the sales document.
QUICK GUIDE
Endpoints:
All API requests are made by https POST or GET requests to a Linet API Endpoint that will always start with: https://app.linet.org.il/api
Endpoints examples:
- Create document: https://app.linet.org.il/api/create/docs
- Update account: https://app.linet.org.il/api/update/accounts?id=435
Extended endpoints guide here
Actions available through API are:
- Create
- Update
- Delete (Should Not be used on Documents, Items and Accounts)
- Search
- Print (Includes send action, Print action is available only for documents module).
- Inventory query (This action is available
Objects (Models) available for making actions through API are:
Object (Model) | Link to Endpoints Guide | Link to Parameters Guide |
What actions are allowed through API |
What actions are forbidden through API and why? |
Documents |
|
| Create, Update, Search and Print (Includes send) Documents | Deleting a document is forbidden by regulation |
Items |
|
| Create, Update, Search, Delete, | Deleting an item doesn’t really delete items’ record from the DB. Deleting sets it as “inactive” and invisible in the UI. No Transactions/documents/stock actions can be made with inactive items. |
Accounts |
|
| Create, Update, Search, Delete, Inventory query (This action is available only for account type=8=warehouses)
| Deleting an account doesn’t really delete documents’ record from the DB. Deleting sets it as “inactive” and invisible in the UI. No Transactions/documents/stock actions can be made with an inactive account. |
Item Categories |
|
| Create, Update, Search, Delete, |
|
Account Cats. |
|
| Create, Update, Search, Delete, |
|
Company |
|
| Create a new company instance within a subscriber, Update, Search or delete it |
|
Settings |
|
| Update company settings |
|
ENDPOINTS
On the following endpoint guide we will not repeat the full endpoint URI.
We will assume that you have understood that all endpoint URI start with https://app.linet.org.il/api
Documents
/create/doc
{ "docDet": [ { "item_id": 1, "name": "קטורות דרגון בלאד", "description": "", "qty": 2, "currency_id": "ILS", "vat_cat_id": 1, "account_id": "100", "unit_id": 0, "iItem": 95, "iItemWithVat": 1, "warehouse_id": "115" }, ], "docCheq": [ { "type": 3, "currency_id": "ILS", "sum": 190, "doc_sum": 190, "line": 1 } ], "doctype": "9", "status": 2, "account_id": "113", "refnum_ext": "Online Order #13174", "refnum_ids":"44721,", "phone": "058123456", "address": "קפלן 55/77, דירה", "city": "נהריה", "email": "abc123@walla.com", "company": "ליטל לגס", "currency_id": "ILS", "country_id": "IL", "language": "he_il", "autoRound": false, "comments": "", "sendmail": 1, "login_id": "XXXXXXXXXXXXXXXXXXXXXXX", "login_hash": "YYYYYYYYYYYYYYYYYYYYYYYYY", "login_company": "1" } |
/newsearch/doc
{ "login_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXX", "login_hash": "YYYYYYYYYYYYYYYYYYYYYYYYYYYYY", "login_company": "1", "query": { "issue_date": "2021-7-12 to 2999-12-31", "refstatus": null } } |
/print/doc
Items
/create/item*
/update/item*
/delete/item*
/stockall/item?id=456
Search active items by created date since …, and belong to category ID 1, and value in custom field is “כן”
{ "active": 1, "limit": 10, "eav3": "כן", "category_id": 1, "offset": 0, "since": "2021-12-01 00:00:00", "login_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "login_hash": "YYYYYYYYYYYYYYYYYYYYYYYYYYY", "login_company": "1" } |
Search items by custom field ID 3 (eav3) value
{ "login_id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "login_hash":"YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY", "login_company":1, "query":{"eav3": 2 } } |
Item Categories
/create/itemcategory
/update/itemcategory
/delete/itemcategory
/search/itemcategory
Accounts
/create/account*
/update/account*
/delete/account*
/newsearch/account
{ "login_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "login_hash": "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY", "login_company": "1", "limit": 5, "query": { "type": 0, "phone": "1234567" } } |
{ "login_id": "AAAAAAAAAAAAAAAAAAAAAAAAA", "login_hash": "XXXXXXXXXXXXXXXXXXXXXXXXXX", "login_company": "1", "query":{"id": 113} } |
Account Categories
Company
Settings
WEBHOOKS-NOTIFICATIONS
External applications can get notifications about events in Linet objects to their own endpoints (URI).
Objects (Models) in Linet with support for sending webhook notifications:
- Items (Insert, Update, Delete)
- Item categories (Insert, Update, Delete)
- Accounts (Insert, Update, Delete)
- Documents (Insert, Update)
Some important highlights about notifications
- Attribute
- Condition for an attributes’ value. Supported Conditions:
- Equals
- Starts with
- Smaller then
- Bigger then
- Notifications can be sent to multiple endpoints, even for the same events.
- For the time being, the notifications creation and configuration interface is not accessible for subscribers and users. All creation and configuration of those notifications are made by Linet support staff after a written request from a subscriber, accompanied with provided endpoint/s for sending the notifications to.
Filtering notifications explained
Sometimes we want to get conditional notifications about events. Filtering notifications gives us the tool to place a value of an attribute that if it has fulfilled its condition, it will be granted the permission to be sent out to its endpoint.
Notification filtering use case example
Let’s say we have a website to update with a list of selected items.
Let's say one of the attributes of items is a field, labeled “upload to web?”.
If this fields’ value is “Yes”, Linet will send a notification, as soon as the item gets updated within the Linet environment. If the value of this attribute is any other, no notification won’t be ever sent. This way, the website will have updates only about items that should be uploaded to it and save overhead for unnecessary data traffic and compute power.
Webhook Examples:
Example 1: Item Update
snsmsg: { "Type": "", "Message": "afterUpdate-\\app\\models\\Item-1248", "MessageNext": { "title": "afterUpdate-\\app\\models\\Item-1248", "event": "afterUpdate", "classname": "\\app\\models\\Item", "sender": "1248", "model": { "profitUp": "2", "id": "1248", "name": "\u05d3\u05d2\u05dd 757576", "itemVatCat_id": "1", "unit_id": "0", "extcatnum": "", "sku": "494404770", "manufacturer": "", "saleprice": 4500, "currency_id": "ILS", "ammount": "0.0000", "owner": 1953, "category_id": "11", "parent_item_id": 0, "isProduct": 1, "profit": 0, "purchaseprice": 0, "pic": "6118fe7c-34de-11ec-acfc-ae2d5c05ccd3", "description": "", "stockType": "1", "modified": { "expression": "NOW()", "params": [ ] }, "created": "2021-10-24 15:22:55", "income_acc": "100", "vatIn": "1", "purchase_currency_id": "ILS", "active": 1, "priceLock": 0, "warranty": "", "uuid": "42ddcda2-34de-11ec-a401-8add22006254", "account_uuid": null, "parent_item_uuid": null, "pvatIn": 0, "bundleSize": null, "api": 0, "scalable": 0 } } } |
Example 2: Item Category Create (Insert)
snsmsg: { "Type": "", "Message": "afterInsert-\\app\\models\\Itemcategory-16", "MessageNext": { "title": "afterInsert-\\app\\models\\Itemcategory-16", "event": "afterInsert", "classname": "\\app\\models\\Itemcategory", "sender": 16, "model": { "profit": 0, "name": "\u05ea\u05d5\u05e1\u05e4\u05d9 \u05de\u05d6\u05d5\u05df", "parent_id": 0, "priority": "5", "discount": 0, "pic": "914033be-679b-11ec-947c-4ae19306a7e5", "id": 16 } } }
|
Example 3: Account Create (Insert)
snsmsg: { "Type": "", "Message": "afterInsert-\\app\\models\\Accounts-204", "MessageNext": { "title": "afterInsert-\\app\\models\\Accounts-204", "event": "afterInsert", "classname": "\\app\\models\\Accounts", "sender": "204", "model": { "type": "0", "parent_account_id": 0, "balance_id": "6", "active": 1, "id6111": "0", "cat_id": "0", "country_id": "US", "name": "\u05e8\u05d5\u05ea\u05dd \u05d4\u05dc\u05d1\u05e5", "currency_id": "ILS", "vatnum": "925497984", "pay_terms": "915", "discount": 0, "email": "", "web": "", "phone": "0544789794", "cellular": "0524780789", "fax": "", "address": "12101 Tukwila International Blvd", "city": "Seattle, Washington", "zip": "", "bank_name": "", "bank_branch": "", "bank_acc": "", "comments": "", "created": { "expression": "NOW()", "params": [ ] }, "owner": 1953, "uuid": "ea942634-679e-11ec-b83a-e23c97a03859", "id": "204" } } }
|