תיעוד ה- API לינט

מדריך למשתמש-לינט

הקדמה, הסבר ודוגמאות למהות ה-API:

ייעודו של ה-API הוא לשמש תשתית התחברות אל לינט לכל מי שמעוניינים לבצע פעולות אוטומטיות, מידיות ומקוונות בלינט על ידי שליחת פקודות ללינט מאתרי מכירות אינטרנטיים ומתכנות/מאפליקציות אחרות. הפעולות מתבצעות כנגד המנוי שלך בלינט וכלפי חברה מסוימת במנוי. כל זה, כמובן לאחר זיהוי ואישור של התוכנה הפונה.

דוגמה ליישום ה-API: נניח שאני בעלים של עסק עם חנות אינטרנטית ואני רוצה שכשלקוח נרשם על מנת לרכוש משהו בחנות הווירטואלית שלי, האתר יבדוק תחילה בלינט האם קיים כבר לקוח בשם זה. אם לא, החנות תרשום אותו בתור לקוח חדש בלינט. אם כן תמשיך הלאה לפעולות הבאות. כנ”ל גם לגבי המוצר/ים שהלקוח מעוניין לרכוש: האתר יבצע בדיקה מול לינט אם המוצר קיים במלאי ואם כן, תתבצע המכירה שבסופה החנות תשלח בקשות ללינט על מנת לבצע חיוב כרטיס אשראי של הלקוח, להפיק חשבונית מס קבלה, לשלוח אותה ללקוח במייל, ולהדפיס תעודת משלוח לשם ביצוע משלוח פיסי של המוצר במידת הצורך.

במקרה כזה, עלי כלקוח מוטלת החובה להוסיף שורות קוד בתכנת החנות הווירטואלית. הפקודות שהוא יוסיף לתוכנה שלו חייבות להיות במסגרת הכללים שמכתיב ה-API של לינט.

לסיכום, מצד אחד נכון שפיתוח התחברות ל-API של לינט מצריך ידע בסיסי בתכנות והוא מחוץ לגדר יכולותיו של משתמש מחשב שאינו מתכנת, אך מצד שני, שימוש ב-API מקצר מאוד את זמן הפיתוח הדרוש לביצוע ממשק כזה מכיוון שיש צורך בפיתוח קוד רק בצד אחד של ההתממשקות שבין שתי התכנות: רק בצד התכנה המתחברת אל לינט. במילים אחרות: אין צורך לשנות את הקוד של לינט על מנת לגרום ללינט לקבל הוראות מתוכנה אחרת.

API של לינט

להלן דוגמאות קוד של פקודות API :
  1. קישור להורדת קוד של פלאגין שכתבנו ב-PHP עבור WordPress על מנת לבצע הפקת מסמכים אוטומטית בלינט עבוררכישות בחנות ווירטואלית מסוג Woocommerce, סנכרון הדדי של מלאי בין התוכנה לחנות WC , וכדומה
  2. קישור לדוגמאות קוד אחרות.
להלן מדריך פקודות ל-API של לינט. הוא כתוב באנגלית על מנת להקל על המתכנת:

Linet implements RESTful approach for its API.

/All access to Linet API is made by making a request towards the url: https://app.linet.org.il/api

To use the API you must provide a valid login.

API  login has two components:   1. API ID   2. API key

Here is a link  for a tutorial page for creating both API ID & API key

Those login credentials can be created only within Linet application’s user interface and only by an administrative user logged in to the Linet User Interface. Administrative user is the user (email address +password) who created the tenant subscription within Linet SAAS ERP system.

The JSON response is this format:

{

“status”: http status code. as in http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

“text”: http status code description.

“body”: the object

“errorCode”: if an error is provided the body will have a description in text normaly 1s in the API 1}

Models with no company dependency:

company

user

language

acccountry

Other supported models (company dependent models):

AuthAssignment         //dual mode*

AuthItem                    //dual mode*

AuthItemChild         //dual mode*

bankbook

bankname

settings

accounts

acctype

accid6111

acchist

currates

docs

doctype

item

itemcategory

inventoryitem

itemunit

itemvatcat

userincomemap

transaction

files

paymenttype

*Models marked in dual mode can also work with no company select  but then they are working on global scope. If company is selected the command will work only on selected company.

Search

POST:                /api/search/

BODY:                {

login_id:”userId”,

login_hash:”userHash”,

login_company:”companyId”,

:””,

}

RESPONSE:        JSON response

List

POST:                api/list/

BODY:                {

login_id:”userId”,

login_hash:”userHash”,

login_company:”companyId”,

}

RESPONSE:        JSON response

View

POST:                api/view//

BODY:                {

login_id:”userId”,

login_hash:”userHash”,

login_company:”companyId”,

}

RESPONSE:        JSON response

Create

POST:                api/create/

BODY:                {

login_id:”userId”,

login_hash:”userHash”,

login_company:”companyId”,

:””,

}

RESPONSE:        JSON response

Update

POST:                api/update//

BODY:                {

login_id:”userId”,

login_hash:”userHash”,

login_company:”companyId”,

:””,

}

RESPONSE:        JSON response

Delete

POST:                api/delete//

BODY:                {

login_id:”userId”,

login_hash:”userHash”,

login_company:”companyId”,

}

RESPONSE:        JSON response

Print

POST:                api/print//

BODY:                {

login_id:”userId”,

login_hash:”userHash”,

login_company:”companyId”,

}

RESPONSE:        JSON response

Send

POST:                api/send//

BODY:                {

login_id:”userId”,

login_hash:”userHash”,

login_company:”companyId”,

}

RESPONSE:        JSON response

Model Details

company [model index]

manage the companies in an instance.

actions:

create,update,delete,search,list,view

user [model index]

manage the users in an instance

actions:

create,update,delete,search,list,view

language [model index]

manage the available languages in an  instance

actions:

create,update,delete,search,list,view

acccountry [model index]

manage the available account countries in an instance

this model should not be used as the list is legal obligatory by the israeli tax authorities

actions:

create,update,delete,search,list,view

AuthAssignment [model index]         //dual mode*

AuthItem  [model index]                   //dual mode*

AuthItemChild  [model index]        //dual mode*

bankbook [model index]

manage Bank Book

actions:

create,update,delete,search,list,view

bankname [model index]

manage available Banks in a company

actions:

create,update,delete,search,list,view

settings [model index]

manage Company Settings (name,address,phone numbers email,zip code,tax rate…..)

actions:

create,update,delete,search,list,view

accounts [model index]

manage Accounts

actions:

create,update,delete,search,list,view

fields:

required: name, type

integer :cat_id, pay_terms

vatnum: if not empty must be a valid VAT number

name: varchar(80)

contact: varchar(80)

department: varchar(60)

email: varchar(50)

web: varchar(60) should be a URL

city: varchar(40)

type: get valid list from acctype

parent_account_id: get valid list from accounts

currency_id: get valid list from currates

system_acc: {0,1}

owner: get valid list from user

id6111: get valid list from accid6111

zip

src_tax

address

phone

dir_phone

cellular

fax

src_date

comments

acctype [model index]

manage Account Types(customer,supplier,bank…)

USE WITH CAUTION! If account type is deleted some functionality will might get lost. For example: If account type “customers” is deleted,  accounts belonged to this type can not be displayed anywhere within the application, although data of customer details as well as customers’ transactions would not be lost, new accounts can not be categorized as customer account etc.

actions:

create,update,delete,search,list,view

accid6111 [model index]

manage Account 6111, Israeli tax authority definition

actions:

create,update,delete,search,list,view

acchist [model index]

manage Account Connection History

actions:

create,update,delete,search,list,view

Currates [model index]

manage Currency rates

actions:

create,search,list,view

docs [model index]

manage Documents

actions:

create,update,delete,search,list,view,print

fields:

required: account_id

disType

status

printed

owner: get valid list from user

city

doctype: get valid list from doctype

oppt_account_id: get valid list from accounts

account_id: get valid list from accounts

zip

vatnum: if not empty must be a valid VAT number

company

address

currency_id: get valid list from currates

refnum: get valid list from docs (comma separated)

rcptsum

discount

sub_total

novat_total

vat

total

src_tax

issue_date

due_date

comments

description

refstatus

docDet:array of(

        array(

required: name, line

line

name

qty

description

unit_id: get valid list from itemunit

item_id: get valid list from item

currency_id: get valid list from currates

iItem: send this will overide iTotal,iTotalVat

iTotal: send only this if you want price to add VAT

iTotalVat: send only this if you want final price including VAT

)

)

docCheq:array of(

        array(

type: get valid list from paymenttype

line

currency_id: get valid list from currates

sum

        )

)

doctype [model index]

manage Document types(Invoice,receipt…)

USE WITH CAUTION ! If doctype is deleted, some functionality will might get lost. For example: If document type: invoices, is deleted, no invoices will be produced by the application anymore.

actions:

create,update,delete,search,list,view

item [model index]

manage Items

actions:

create,update,delete,search,list,view

fields:

required: sku, name, currency_id, category_id, parent_item_id, isProduct, stockType, itemVatCat_id, unit_id

integer: isProduct, profit, stockType

name: varchar(255)

itemVatCat_id: get valid list from itemvatcat

unit_id: get valid list from itemunit

parent_item_id: get valid list from item

category_id: get valid list from itemcategory

stockType:

description: text

purchaseprice: decimal(20,2)

saleprice: decimal(20,2)

currency_id: get valid list from Currates

pic: file

owner: get valid list from user

itemcategory [model index]

manage Item Categories

actions:

create,update,delete,search,list,view

inventoryitem [model index]

Manage inventory item transactions between warehouses, incoming and outgoing items transactions from /to clients/suppliers.

actions:

only create,search,list,view

*can not update!

*can not delete!

itemunit [model index]

manage Item Unit Types(cm,kg,mg,gb,mhz…)

actions:

create,update,delete,search,list,view

itemvatcat [model index]

Manage VAT category for an item (useful only in countries with differential vat system by categories)

actions:

create,update,delete,search,list,view

userincomemap [model index]

Mapping of item vat category to specific income account

actions:

create,update,delete,search,list,view

transaction [model index]

manage transactions in a company

actions:

only create,search,list,view

*can not update!

*can not delete!

files [model index]

manage files in company

actions:

create,update,delete,search,list,view

paymenttype [model index]

manage files in company

actions:

create,update,delete,search,list,view

מסמך זה נכתב ונערך על ידי אדם בן חור. כל הזכויות שמורות למחבר.  © All Rights Reserved . אין להעתיק, לצלם, לפרסם את הנאמר במסמך זה בכללותו או בחלקים ממנו ללא קבלת אישור מבעל הזכויות מראש ובכתב

נגישות
לייעוץ ישיר
ייעוץ ישיר
הרשמה