{"openapi":"3.0.3","info":{"title":"ניפנדו – SAP Business One API","version":"0.2.0","description":"API עבור ניפנדו המאפשר קריאה וכתיבה ל SAP. ההסבר המלא: /docs"},"security":[{"token":[]}],"tags":[{"name":"מסמכים","description":"קריאה, חיפוש ויצירה של מסמכי שיווק ורכש"},{"name":"טיוטות","description":"טיוטה לכל סוג מסמך: יצירה, רשימה, עדכון, והפיכה למסמך"},{"name":"PDF וקבצים","description":"ה-PDF של מסמך והקבצים המצורפים אליו"},{"name":"מידע","description":"סוגי המסמכים, השדות ובדיקת חיבור"}],"paths":{"/api/v1/{company}/{docType}":{"get":{"tags":["מסמכים"],"summary":"רשימת מסמכים","description":"מחזיר עמוד של מסמכים: Count (כמה עונים לפילטר), Top, Skip ו-Documents. בלי expand=lines חוזר רק ה-Header.\r\n\r\nדוגמאות לפילטר:\r\n\r\n* `Partner_Code eq 'C20000'`\r\n* `Issue_Date ge 2026-01-01 and Status eq 'Open'`\r\n* `contains(Partner_Name, 'אקמה')`\r\n* `Document_Number in (1001, 1002)`\r\n* `User_Fields.Send_To_Nipendo eq 'Y'`","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"filter","in":"query","required":false,"description":"פילטר: Partner_Code eq 'C20000' and Issue_Date ge 2026-01-01","schema":{"type":"string"},"example":"Status eq 'Open'"},{"name":"updatedSince","in":"query","required":false,"description":"רק מסמכים שהשתנו מאז (סנכרון מצטבר): 2026-11-01T00:00:00","schema":{"type":"string"}},{"name":"orderby","in":"query","required":false,"description":"מיון: Issue_Date desc","schema":{"type":"string"}},{"name":"top","in":"query","required":false,"description":"גודל עמוד: 1 עד 500, ברירת מחדל 50","schema":{"type":"integer"}},{"name":"skip","in":"query","required":false,"description":"כמה לדלג","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"lines: להחזיר גם את השורות","schema":{"type":"string","enum":["lines"]}}],"responses":{"200":{"description":"הצלחה","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentList"}},"application/xml":{"schema":{"$ref":"#/components/schemas/DocumentList"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["מסמכים"],"summary":"יצירת מסמך","description":"יוצר מסמך ב-SAP מאותו מבנה ש-GET מחזיר. שדות מסומנים readOnly (סכומים, סטטוס, מספרים פנימיים) מתקבלים ולא\r\nמשפיעים, כך שאפשר לשלוח בחזרה בדיוק את מה שהתקבל ב-GET. שם שדה שלא קיים נדחה עם 400 ועם שם השדה.\r\n\r\n* **Transaction_ID**: המזהה שלכם. אותו Transaction_ID פעמיים יוצר מסמך אחד בלבד.\r\n* **Base_Document**: יצירת מסמך המשך (למשל חשבונית ספק מהזמנת רכש) לפי מספר המסמך או Document_Entry שלו.\r\n* **Partner_Item_Code** במקום Item_Code: הפריט נמצא לפי המק\"ט שלכם אצל הספק או הלקוח.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"validateTotals","in":"query","required":false,"description":"true: לדחות (בלי ליצור כלום) אם הסכום ש-SAP חישב שונה מ-Financial_Details.Total_Include_VAT","schema":{"type":"boolean"}}],"responses":{"201":{"description":"נוצר. מחזיר את המסמך כפי שנשמר ב-SAP, עם Document_Entry ו-Document_Number.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}},"200":{"description":"קיים כבר מסמך עם אותו Transaction_ID: מוחזר הקיים, ולא נוצר חדש.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"},"example":{"Header":{"Transaction_ID":"NPD-2026-000981","Issue_Date":"2026-11-26","Due_Date":"2026-12-26","Partner_Details":{"Partner_Code":"S10020","Partner_Reference":"INV-88123"},"Financial_Details":{"Currency":"ILS"},"Header_Texts":{"Remark":"התקבל מניפנדו"},"User_Fields":{}},"Lines":[{"Item_Details":{"Item_Code":"A1000","Quantity":100},"Item_Financial_Details":{"Unit_Price_Before_Discount":10},"Base_Document":{"Base_Document_Type":"purchase-orders","Base_Document_Number":230045,"Base_Line_Id":0}}],"Attachments":[{"File_Name":"supplier-invoice","File_Extension":"pdf","Encoding":"base64","File_Content":"JVBERi0xLjcK..."}]}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}}}},"/api/v1/{company}/{docType}/{docEntry}":{"get":{"tags":["מסמכים"],"summary":"מסמך אחד","description":"המסמך המלא: Header ו-Lines.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"docEntry","in":"path","required":true,"description":"Document_Entry של המסמך (המפתח הפנימי של SAP)","schema":{"type":"integer"}},{"name":"include","in":"query","required":false,"description":"pdf, attachments, או שניהם מופרדים בפסיק: להוסיף את ה-PDF (Business_Document) ואת הקבצים המצורפים עם התוכן","schema":{"type":"string"}}],"responses":{"200":{"description":"הצלחה","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["מסמכים"],"summary":"עדכון מסמך","description":"מקבל את אותו מבנה, אבל רק מה שמשתנה: שדה בכותרת שנשלח מתעדכן, שורה עם Line_Id מתעדכנת, שורה בלי Line_Id נוספת,\r\nוקבצים ב-Attachments מצורפים. מה שאפשר לשנות קובע SAP: במסמך פתוח כמעט הכל, במסמך סגור או בחשבונית שנרשמה בעיקר\r\nהערות ושדות משתמש. מה ש-SAP לא מאפשר חוזר כ-422, ושום דבר לא משתנה.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"docEntry","in":"path","required":true,"description":"Document_Entry של המסמך (המפתח הפנימי של SAP)","schema":{"type":"integer"}},{"name":"validateTotals","in":"query","required":false,"description":"true: לדחות (בלי לשנות כלום) אם הסכום ש-SAP חישב שונה מ-Financial_Details.Total_Include_VAT","schema":{"type":"boolean"}}],"responses":{"200":{"description":"עודכן. מחזיר את המסמך כפי שהוא עכשיו ב-SAP.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"},"example":{"Header":{"Header_Texts":{"Remark":"עודכן מניפנדו"}},"Lines":[{"Line_Id":0,"Item_Details":{"Quantity":4}},{"Item_Details":{"Item_Code":"A1000","Quantity":2},"Item_Financial_Details":{"Unit_Price_Before_Discount":5}}]}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}}}},"/api/v1/{company}/{docType}/drafts":{"get":{"tags":["טיוטות"],"summary":"רשימת טיוטות","description":"הטיוטות של סוג המסמך שעוד לא הפכו למסמך. אותו סינון ועמודים כמו ברשימת מסמכים.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"filter","in":"query","required":false,"description":"פילטר, כמו ברשימת מסמכים","schema":{"type":"string"}},{"name":"orderby","in":"query","required":false,"description":"מיון","schema":{"type":"string"}},{"name":"top","in":"query","required":false,"description":"גודל עמוד: 1 עד 500","schema":{"type":"integer"}},{"name":"skip","in":"query","required":false,"description":"כמה לדלג","schema":{"type":"integer"}},{"name":"expand","in":"query","required":false,"description":"lines: עם השורות","schema":{"type":"string","enum":["lines"]}}],"responses":{"200":{"description":"הצלחה","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentList"}},"application/xml":{"schema":{"$ref":"#/components/schemas/DocumentList"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["טיוטות"],"summary":"יצירת טיוטה","description":"כמו יצירת מסמך, אבל נשמר כטיוטה ב-SAP. לכל 17 סוגי המסמכים. טיוטה של חשבונית מקדמה נשמרת כבקשת מקדמה.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"validateTotals","in":"query","required":false,"description":"true: לדחות (בלי לשנות כלום) אם הסכום ש-SAP חישב שונה מ-Financial_Details.Total_Include_VAT","schema":{"type":"boolean"}}],"responses":{"201":{"description":"נוצרה. מחזיר את הטיוטה, עם ה-Document_Entry שלה.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"},"example":{"Header":{"Transaction_ID":"NPD-2026-000981","Issue_Date":"2026-11-26","Due_Date":"2026-12-26","Partner_Details":{"Partner_Code":"S10020","Partner_Reference":"INV-88123"},"Financial_Details":{"Currency":"ILS"},"Header_Texts":{"Remark":"התקבל מניפנדו"},"User_Fields":{}},"Lines":[{"Item_Details":{"Item_Code":"A1000","Quantity":100},"Item_Financial_Details":{"Unit_Price_Before_Discount":10},"Base_Document":{"Base_Document_Type":"purchase-orders","Base_Document_Number":230045,"Base_Line_Id":0}}],"Attachments":[{"File_Name":"supplier-invoice","File_Extension":"pdf","Encoding":"base64","File_Content":"JVBERi0xLjcK..."}]}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}}}},"/api/v1/{company}/{docType}/drafts/{docEntry}":{"get":{"tags":["טיוטות"],"summary":"טיוטה אחת","description":"הטיוטה המלאה.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"docEntry","in":"path","required":true,"description":"Document_Entry של המסמך (המפתח הפנימי של SAP)","schema":{"type":"integer"}}],"responses":{"200":{"description":"הצלחה","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["טיוטות"],"summary":"עדכון טיוטה","description":"מקבל את אותו מבנה, אבל רק מה שמשתנה: שדה בכותרת שנשלח מתעדכן, שורה עם Line_Id מתעדכנת, שורה בלי Line_Id נוספת,\r\nוקבצים ב-Attachments מצורפים. מה שאפשר לשנות קובע SAP: במסמך פתוח כמעט הכל, במסמך סגור או בחשבונית שנרשמה בעיקר\r\nהערות ושדות משתמש. מה ש-SAP לא מאפשר חוזר כ-422, ושום דבר לא משתנה.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"docEntry","in":"path","required":true,"description":"Document_Entry של המסמך (המפתח הפנימי של SAP)","schema":{"type":"integer"}},{"name":"validateTotals","in":"query","required":false,"description":"true: לדחות (בלי לשנות כלום) אם הסכום ש-SAP חישב שונה מ-Financial_Details.Total_Include_VAT","schema":{"type":"boolean"}}],"responses":{"200":{"description":"עודכנה. מחזיר את הטיוטה.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"},"example":{"Header":{"Header_Texts":{"Remark":"עודכן מניפנדו"}},"Lines":[{"Line_Id":0,"Item_Details":{"Quantity":4}},{"Item_Details":{"Item_Code":"A1000","Quantity":2},"Item_Financial_Details":{"Unit_Price_Before_Discount":5}}]}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}}}},"/api/v1/{company}/{docType}/drafts/{docEntry}/save":{"post":{"tags":["טיוטות"],"summary":"הפיכת טיוטה למסמך","description":"יוצר את המסמך עצמו מהטיוטה. הטיוטה נשארת ב-SAP כסגורה, ושמירה שנייה שלה נדחית עם 409.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"docEntry","in":"path","required":true,"description":"Document_Entry של המסמך (המפתח הפנימי של SAP)","schema":{"type":"integer"}}],"responses":{"201":{"description":"המסמך החדש שנוצר מהטיוטה.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Document"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/v1/{company}/{docType}/{docEntry}/pdf":{"get":{"tags":["PDF וקבצים"],"summary":"ה-PDF של המסמך","description":"ה-PDF כפי ש-SAP מדפיס אותו, ב-Layout ברירת המחדל של הלקוח. כקובץ, או עם ?format=base64 כ-JSON.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"docEntry","in":"path","required":true,"description":"Document_Entry של המסמך (המפתח הפנימי של SAP)","schema":{"type":"integer"}},{"name":"format","in":"query","required":false,"description":"base64: להחזיר JSON עם Business_Document במקום קובץ","schema":{"type":"string","enum":["base64"]}},{"name":"layout","in":"query","required":false,"description":"קוד Layout אחר במקום ברירת המחדל","schema":{"type":"string"}}],"responses":{"200":{"description":"ה-PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{"type":"object","properties":{"Business_Document":{"$ref":"#/components/schemas/Business_Document"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/v1/{company}/{docType}/{docEntry}/attachments":{"get":{"tags":["PDF וקבצים"],"summary":"הקבצים המצורפים","description":"רשימת הקבצים, בלי התוכן; לכל קובץ Download_Url.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"docEntry","in":"path","required":true,"description":"Document_Entry של המסמך (המפתח הפנימי של SAP)","schema":{"type":"integer"}}],"responses":{"200":{"description":"הצלחה","content":{"application/json":{"schema":{"type":"object","properties":{"Attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}}},"application/xml":{"schema":{"type":"object","properties":{"Attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["PDF וקבצים"],"summary":"צירוף קבצים למסמך קיים","description":"הקבצים נוספים לאלה שכבר מצורפים.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"docEntry","in":"path","required":true,"description":"Document_Entry של המסמך (המפתח הפנימי של SAP)","schema":{"type":"integer"}}],"responses":{"201":{"description":"צורף. מחזיר את כל הקבצים של המסמך.","content":{"application/json":{"schema":{"type":"object","properties":{"Attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}}},"application/xml":{"schema":{"type":"object","properties":{"Attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"Attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}},"example":{"Attachments":[{"File_Name":"signed-delivery","File_Extension":"pdf","Encoding":"base64","File_Content":"JVBERi0xLjcK..."}]}},"application/xml":{"schema":{"type":"object","properties":{"Attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}}}}}}},"/api/v1/{company}/{docType}/{docEntry}/attachments/{line}":{"get":{"tags":["PDF וקבצים"],"summary":"קובץ מצורף אחד","description":"הקובץ עצמו, או עם ?format=base64 כ-JSON.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}},{"name":"docEntry","in":"path","required":true,"description":"Document_Entry של המסמך (המפתח הפנימי של SAP)","schema":{"type":"integer"}},{"name":"line","in":"path","required":true,"description":"Attachment_Line","schema":{"type":"integer"}},{"name":"format","in":"query","required":false,"description":"base64: JSON במקום קובץ","schema":{"type":"string","enum":["base64"]}}],"responses":{"200":{"description":"הקובץ","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{"$ref":"#/components/schemas/Attachment"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/v1/companies":{"get":{"tags":["מידע"],"summary":"החברות","description":"החברות שהטוקן פותח: Company (לכתובת) ו-Company_Name (השם ב-SAP).","parameters":[],"responses":{"200":{"description":"הצלחה","content":{"application/json":{"schema":{"type":"object"}},"application/xml":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/v1/document-types":{"get":{"tags":["מידע"],"summary":"סוגי המסמכים","description":"כל סוגי המסמכים שה-API תומך בהם.","parameters":[],"responses":{"200":{"description":"הצלחה","content":{"application/json":{"schema":{"type":"object"}},"application/xml":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/v1/{company}/fields/{docType}":{"get":{"tags":["מידע"],"summary":"השדות של סוג מסמך","description":"כל השדות של סוג המסמך אצל הלקוח, כולל שדות המשתמש שלו: סוג, האם קריא בלבד, האם אפשר לסנן לפיו, וערכים חוקיים.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}},{"name":"docType","in":"path","required":true,"description":"סוג המסמך","schema":{"type":"string","enum":["sales-quotations","sales-orders","deliveries","return-requests","returns","ar-down-payments","ar-invoices","ar-credit-notes","purchase-requests","purchase-quotations","purchase-orders","goods-receipts","goods-return-requests","goods-returns","ap-down-payments","ap-invoices","ap-credit-notes"]}}],"responses":{"200":{"description":"הצלחה","content":{"application/json":{"schema":{"type":"object"}},"application/xml":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/api/v1/{company}/ping":{"get":{"tags":["מידע"],"summary":"בדיקת חיבור","description":"בודק שהטוקן תקין ושיש חיבור ל-SAP.","parameters":[{"name":"company","in":"path","required":true,"description":"החברה: Company כפי ש-GET /api/v1/companies מחזיר","schema":{"type":"string"}}],"responses":{"200":{"description":"הצלחה","content":{"application/json":{"schema":{"type":"object"}},"application/xml":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}}},"components":{"securitySchemes":{"token":{"type":"http","scheme":"bearer","description":"טוקן ההתחברות שמוגדר בפורטל של SAP Port One. נשלח בכל קריאה: Authorization: Bearer <token>."}},"schemas":{"Partner_Details":{"type":"object","properties":{"Partner_Code":{"type":"string","description":"The customer or supplier (CardCode).","nullable":true},"Partner_Name":{"type":"string","description":"Its name on the document.","nullable":true},"Partner_VAT_Number":{"type":"string","description":"Its VAT or company number (LicTradNum).","nullable":true},"Partner_Reference":{"type":"string","description":"Its own number for the document: its PO, its invoice (NumAtCard).","nullable":true},"Contact_Person_Name":{"type":"string","description":"The contact person, by name among the partner's contacts.","nullable":true},"Contact_Phone_Number":{"type":"string","description":"The contact person's phone.","nullable":true,"readOnly":true},"Contact_Email":{"type":"string","description":"The contact person's e-mail.","nullable":true,"readOnly":true}}},"Bill_To_Details":{"type":"object","properties":{"Bill_To_Code":{"type":"string","description":"The partner's bill-to address, by its name.","nullable":true},"Bill_To_Full_Address":{"type":"string","description":"The bill-to address as printed.","nullable":true,"readOnly":true},"Street":{"type":"string","nullable":true},"Block":{"type":"string","nullable":true},"City":{"type":"string","nullable":true},"Zip_Code":{"type":"string","nullable":true},"State":{"type":"string","nullable":true},"Country":{"type":"string","description":"ISO country code.","nullable":true}}},"Ship_To_Details":{"type":"object","properties":{"Ship_To_Code":{"type":"string","description":"The partner's ship-to address, by its name.","nullable":true},"Ship_To_Full_Address":{"type":"string","description":"The ship-to address as printed.","nullable":true,"readOnly":true},"Street":{"type":"string","nullable":true},"Block":{"type":"string","nullable":true},"City":{"type":"string","nullable":true},"Zip_Code":{"type":"string","nullable":true},"State":{"type":"string","nullable":true},"Country":{"type":"string","description":"ISO country code.","nullable":true},"Delivery_Type":{"type":"string","description":"The shipping type, by name.","nullable":true}}},"Financial_Details":{"type":"object","properties":{"Currency":{"type":"string","description":"The document's currency.","nullable":true},"Exchange_Rate":{"type":"number","nullable":true},"Total_Before_Discount":{"type":"number","description":"Before the header discount and VAT.","nullable":true,"readOnly":true},"Header_Discount_Percentage":{"type":"number","nullable":true},"Header_Discount_Amount":{"type":"number","nullable":true,"readOnly":true},"Total_Before_VAT":{"type":"number","nullable":true,"readOnly":true},"VAT_Amount":{"type":"number","nullable":true,"readOnly":true},"Total_Include_VAT":{"type":"number","nullable":true,"readOnly":true},"Paid_Amount":{"type":"number","nullable":true,"readOnly":true},"Open_Amount":{"type":"number","nullable":true,"readOnly":true},"Payment_Terms_Code":{"type":"integer","nullable":true},"Payment_Terms_Description":{"type":"string","nullable":true,"readOnly":true}}},"Employee_Details":{"type":"object","properties":{"Sales_Employee_Code":{"type":"integer","description":"The sales employee, or the buyer on a purchasing document.","nullable":true},"Sales_Employee_Name":{"type":"string","nullable":true,"readOnly":true},"Owner_Code":{"type":"integer","description":"The document's owner (an employee).","nullable":true},"Owner_Name":{"type":"string","nullable":true,"readOnly":true}}},"Project_Details":{"type":"object","properties":{"Project_Code":{"type":"string","nullable":true},"Project_Name":{"type":"string","nullable":true,"readOnly":true}}},"Header_Texts":{"type":"object","properties":{"Remark":{"type":"string","nullable":true},"Opening_Text":{"type":"string","nullable":true},"Closing_Text":{"type":"string","nullable":true},"Journal_Remark":{"type":"string","nullable":true}}},"Header":{"type":"object","description":"כותרת המסמך.","properties":{"Transaction_ID":{"type":"string","description":"The caller's id for the document. A POST with an id that exists returns that document instead of a new one.","nullable":true},"Document_Type":{"type":"string","description":"The document type, as in the route.","nullable":true,"readOnly":true},"Document_Entry":{"type":"integer","description":"SAP's internal key (DocEntry).","nullable":true,"readOnly":true},"Document_Number":{"type":"integer","description":"The document number (DocNum).","nullable":true,"readOnly":true},"Series_Name":{"type":"string","description":"The numbering series, by name.","nullable":true},"Status":{"type":"string","description":"Open, Closed or Cancelled.","nullable":true,"readOnly":true},"Is_Cancelled":{"type":"boolean","description":"Whether the document was cancelled.","nullable":true,"readOnly":true},"Item_Or_Service":{"type":"string","description":"Item: lines of items. Service: lines of free text and amounts.","nullable":true},"Issue_Date":{"type":"string","format":"date","description":"The document date (TaxDate).","nullable":true},"Posting_Date":{"type":"string","format":"date","description":"The posting date (DocDate).","nullable":true},"Due_Date":{"type":"string","format":"date","description":"Delivery date on orders, due date on invoices (DocDueDate).","nullable":true},"Allocation_Number":{"type":"string","description":"The tax authority's allocation number (the column is set in the portal: allocationNumberField).","nullable":true,"readOnly":true},"Created_At":{"type":"string","format":"date-time","description":"When the document was made.","nullable":true,"readOnly":true},"Updated_At":{"type":"string","format":"date-time","description":"When the document last changed.","nullable":true,"readOnly":true},"Partner_Details":{"$ref":"#/components/schemas/Partner_Details"},"Bill_To_Details":{"$ref":"#/components/schemas/Bill_To_Details"},"Ship_To_Details":{"$ref":"#/components/schemas/Ship_To_Details"},"Financial_Details":{"$ref":"#/components/schemas/Financial_Details"},"Employee_Details":{"$ref":"#/components/schemas/Employee_Details"},"Project_Details":{"$ref":"#/components/schemas/Project_Details"},"Header_Texts":{"$ref":"#/components/schemas/Header_Texts"},"User_Fields":{"$ref":"#/components/schemas/User_Fields"}}},"Item_Details":{"type":"object","properties":{"Item_Code":{"type":"string","description":"Our item code.","nullable":true},"Item_Description":{"type":"string","nullable":true},"Partner_Item_Code":{"type":"string","description":"The partner's code for the item. On POST without Item_Code, the item is found by it (business partner catalog numbers).","nullable":true},"Bar_Code":{"type":"string","nullable":true,"readOnly":true},"Unit_Of_Measure":{"type":"string","nullable":true},"Quantity":{"type":"number","nullable":true},"Open_Quantity":{"type":"number","nullable":true,"readOnly":true},"Warehouse_Code":{"type":"string","nullable":true},"Line_Delivery_Date":{"type":"string","format":"date","nullable":true}}},"Item_Financial_Details":{"type":"object","properties":{"Unit_Price_Before_Discount":{"type":"number","nullable":true},"Line_Discount_Percentage":{"type":"number","nullable":true},"Unit_Price":{"type":"number","description":"After the line discount.","nullable":true,"readOnly":true},"Total_Line_Before_VAT":{"type":"number","description":"Written on POST only on a service document; on an item document SAP calculates it.","nullable":true},"VAT_Code":{"type":"string","nullable":true},"VAT_Percentage":{"type":"number","nullable":true,"readOnly":true},"Line_VAT_Amount":{"type":"number","description":"The line's total with VAT less without it.","nullable":true,"readOnly":true},"Total_Line_Include_VAT":{"type":"number","nullable":true,"readOnly":true},"Line_Currency":{"type":"string","nullable":true},"Line_Exchange_Rate":{"type":"number","nullable":true},"GL_Account":{"type":"string","nullable":true},"Cost_Center":{"type":"string","nullable":true}}},"Base_Document":{"type":"object","properties":{"Base_Document_Type":{"type":"string","description":"The document this line was copied from, as a route (deliveries).","nullable":true},"Base_Document_Entry":{"type":"integer","nullable":true},"Base_Document_Number":{"type":"integer","description":"On POST instead of Base_Document_Entry: the base document is found by its number.","nullable":true},"Base_Line_Id":{"type":"integer","nullable":true}}},"Line":{"type":"object","description":"שורת מסמך.","properties":{"Line_Number":{"type":"integer","description":"The line's number as shown in SAP; a POST takes the lines in order.","nullable":true,"readOnly":true},"Line_Id":{"type":"integer","description":"SAP's key of the line (LineNum), which stays when lines move.","nullable":true,"readOnly":true},"Line_Status":{"type":"string","nullable":true,"readOnly":true},"Item_Details":{"$ref":"#/components/schemas/Item_Details"},"Item_Financial_Details":{"$ref":"#/components/schemas/Item_Financial_Details"},"Base_Document":{"$ref":"#/components/schemas/Base_Document"},"Line_Remark":{"type":"string","nullable":true},"Line_Text":{"type":"string","description":"The line's long text.","nullable":true},"Batches":{"type":"array","items":{"$ref":"#/components/schemas/Batch"},"description":"אצוות. ב-POST: רק במסמך שמזיז מלאי (תעודת משלוח, קבלת סחורה...)."},"Serial_Numbers":{"type":"array","items":{"$ref":"#/components/schemas/Serial"},"description":"מספרים סידוריים."},"User_Fields":{"$ref":"#/components/schemas/User_Fields"}}},"User_Fields":{"type":"object","additionalProperties":true,"description":"שדות המשתמש של הלקוח ב-SAP, בשמות פשוטים. הרשימה המלאה של החברה, עם הסוגים והערכים החוקיים: GET /api/v1/{company}/fields/{docType}.","example":{"Project_Manager":"רונית","Send_To_Nipendo":"Y"}},"Batch":{"type":"object","properties":{"Batch_Number":{"type":"string","description":"מספר אצווה"},"Batch_Quantity":{"type":"number","description":"כמות"},"Expiration_Date":{"type":"string","format":"date","description":"תאריך תפוגה"}}},"Serial":{"type":"object","properties":{"Serial_Number":{"type":"string","description":"מספר סידורי"},"Expiration_Date":{"type":"string","format":"date","description":"תאריך תפוגה"}}},"Attachment":{"type":"object","properties":{"Attachment_Line":{"type":"integer","description":"מספר הקובץ במסמך","readOnly":true},"File_Name":{"type":"string","description":"שם הקובץ, בלי תיקייה"},"File_Extension":{"type":"string","description":"סיומת, בלי נקודה: pdf"},"Attached_At":{"type":"string","format":"date","description":"תאריך הצירוף","readOnly":true},"Encoding":{"type":"string","description":"תמיד base64"},"File_Content":{"type":"string","format":"byte","description":"תוכן הקובץ ב-Base64"}}},"Business_Document":{"type":"object","properties":{"File_Name":{"type":"string","description":"ar-invoices-410023.pdf"},"File_Extension":{"type":"string","description":"pdf"},"Encoding":{"type":"string","description":"base64"},"Layout_Code":{"type":"string","description":"ה-Layout של SAP שבו הופק המסמך"},"File_Content":{"type":"string","format":"byte","description":"ה-PDF ב-Base64"}},"readOnly":true},"Document":{"type":"object","description":"מסמך: אותו מבנה בקריאה (GET) ובכתיבה (POST).","required":["Header","Lines"],"properties":{"Header":{"$ref":"#/components/schemas/Header"},"Lines":{"type":"array","items":{"$ref":"#/components/schemas/Line"}},"Attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"},"description":"קבצים מצורפים. ב-GET רק עם ?include=attachments."},"Business_Document":{"allOf":[{"$ref":"#/components/schemas/Business_Document"}],"description":"ה-PDF של המסמך. ב-GET רק עם ?include=pdf; ב-POST מתעלמים ממנו."}}},"DocumentList":{"type":"object","properties":{"Count":{"type":"integer","description":"כמה מסמכים עונים לפילטר, בכל העמודים"},"Top":{"type":"integer","description":"גודל העמוד"},"Skip":{"type":"integer","description":"כמה דולגו"},"Documents":{"type":"array","items":{"$ref":"#/components/schemas/Document"}}}},"Error":{"type":"object","properties":{"Error":{"type":"object","properties":{"Code":{"type":"string","description":"BAD_REQUEST, UNAUTHORIZED, NOT_FOUND, SAP_ERROR, TOTALS_MISMATCH..."},"Message":{"type":"string","description":"ההסבר, במילים"},"Field":{"type":"string","description":"השדה שבו הבעיה, כנתיב: Lines[2].Item_Details.Item_Code"},"Sap_Error_Code":{"type":"integer","description":"קוד השגיאה של SAP, כש-SAP דחה"}}}}}},"responses":{"Error":{"description":"שגיאה","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}